1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kipiarov [429]
3 years ago
15

Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the program outputs the sum of

all the prime numbers between the two integers. Two prime numbers are called twin primes, if the difference between the two primes is 2 or -2. Have the program output all the twin primes and the number of twin primes between the two integers.
Computers and Technology
1 answer:
alexira [117]3 years ago
7 0

Answer:

In Python:

low = int(input("Low: "))

high = int(input("High: "))

if low >= 1000000000 or high >=1000000000:

   print("Out of range")

else:

   mylist = []

   for num in range(low,high+1):

       flag = False

       if num > 1:

           for i in range(2, num):

               if (num % i) == 0:

                   flag = True

                   break

       if not flag:

           mylist.append(num)

           print(num, end = " ")

   print()

   print("The twin primes are: ",end="")

   count = 0

   for i in range(1,len(mylist)):

       if mylist[i] - mylist[i-1] == 2:

           print(str(mylist[i])+" & "+str(mylist[i-1]),end=", ")

           count+=1

   print()

   print("There are "+str(count)+" twin primes")

Explanation:

See attachment for complete program where comments were used to explain each line

Download txt
You might be interested in
What is data and instructions entered into the memory of a device
lyudmila [28]

A POINTING DEVICE IS AN INPUT DEVICE THAT ALLOWS A USER TO CONTROL A POINTER ON THE SCREEN. ... A KEYBOARD IS AN INPUT DEVICE THAT CONTAINS KEYS USER TO ENTER DATA AND INSTRUCTIONS INTO A COMPUTER.                                                                            

SORRY FOR CAPS MY CAPS KEY GOT STUCK

3 0
4 years ago
SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater th
kap26 [50]

Answer:Answer:

TRUE

Explanation:

SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater the effect) because one of the factors that affects availability in a satellites is rain. Higher frequencies in Ka-band (30/20 GHz), rain can have a very large effect that simply cannot be overcome at the usual levels of availability.

Rain reduces the quality of signals by interfering with the signals thereby, reducing their strength and quality.

Therefore Rain can not only degrade a satellite's signal, it can also cause a complete outage of the satellite's.

4 0
4 years ago
What is Service Operations in ITIL​
Nostrana [21]

Explanation:

the objective of ITIL service operations is to make sure that IT services are delivered effectively and efficiently. the service operation life cycle stage includes the fulfilling of user requests, resolving service failure fixing problems and also carrying out routine operational tasks

7 0
4 years ago
When you sit for a typing test, what is the first thought that crosses your mind?
MaRussiya [10]
<span>When you sit for a typing test, what is the first thought that crosses your mind?
posture</span>
8 0
3 years ago
Read 2 more answers
Suppose that a queue is implemented using a circular array of size 12. What is the value of last after the following operations?
otez555 [7]

Answer:

10

Explanation:

An enqueue operation is a function that adds an element(value) to a queue array. A dequeue operations removes an element from a queue array. Queue arrays follow a first-in-first-out approach, so elements that are first stored in the queue are removed/accessed first(enqueue operations add elements at the rear of the queue array).

The following operations leave 10 elements in the queue of array size 12 after its done:

10 enqueue operations= adds 10 elements

5 dequeue operations= removes 5 elements( 5 elements left in queue)

6 enqueue operations= adds 6 elements(11 elements in queue)

10 dequeue operations= removes 10 elements(1 element left in queue)

8 enqueue operations= adds 8 elements(9 elements in queue)

2 dequeue operations= removes 2 elements(7 elements left in queue)

3 enqueue operations= adds 3 elements(10 elements in queue)

Therefore there are 10 elements in the queue after enqueue and dequeue operations.

8 0
3 years ago
Other questions:
  • Jessica has pinned her favorite applications as icons on her desktop. She always clicks on these icons to work on them. Which us
    5·1 answer
  • LAB:
    8·1 answer
  • The leader of the team wants to do everything him or herself. They have a very big ego and are difficult to work with. What is t
    14·1 answer
  • “You have been blocked”
    5·2 answers
  • John wants to share resources and move a large volume of data quickly over the Internet. John should use which of the following
    9·1 answer
  • One modeling technique drawn from systems analysis and design that can provide an excellent way to illustrate how a business fun
    13·1 answer
  • Building relationships during your career exploration is called A. clustering. B. futurecasting. C. matchmaking, D. networking.
    9·2 answers
  • Why might it be important to be careful when placing multiple microphones around the same sound source
    14·1 answer
  • For what reasons do readers use text-to-speech tools? Check all that apply.
    8·2 answers
  • Question 1 of 10
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!