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
Is the movie IT really that scary ? Rate between 1-10, 10 being I had nightmares
mezya [45]
5 I don’t think it’s good. I thought it was boring.
4 0
3 years ago
One advantage of taking photographs under fluorescent light is that: Group of answer choices
Alexus [3.1K]

They tend to be dull.

7 0
3 years ago
Thomas owns a small Web services company and currently owns and maintains all his own computing hardware. He plans to develop an
Stels [109]

Answer: Hello the options related to your question is missing attached below are the options

answer : unlimited computing capacity for a low monthly fee ( A )

Explanation:

Since Thomas plans to develop a new service that will require his computing capacity to either double or triple, The best way of transitioning to the public cloud that might help Thomas meet up the requirement is Using unlimited computing capacity for a low monthly fee

7 0
3 years ago
At the time of signing, what was the title of the man who is the first of the two names in the name of the 1901 treaty that null
pshichka [43]
The answer is the US Secretary of State.  <span>At the time of signing,Secretary of State was the title of the man (John Hay) who is the first of the two names in the name of the 1901 treaty that nullified the Clayton-Bulwer Treaty. </span>It was signed by US Secretary of State John Hay and British Ambassador to the United States Lord Pauncefote on the 18th of November 1901. 
3 0
3 years ago
Read 2 more answers
Using the flowchart diagram, identify the decision point of this solution. Identify vendors. Calculate amount due. Determine dat
andreev551 [17]

Answer:

answer is "is there an early pay discount"

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the importance of using the proper markup language?
    8·2 answers
  • The approved systems design document is used by programmers, the personnel department, and information systems personnel.
    8·1 answer
  • Implement the function:
    6·1 answer
  • Nikolas has a idea that he could use the compressed carbon dioxide in a fire extinguisher to propel him on his skateboard. Nikol
    13·2 answers
  • Refer to the color wheel to identify the color scheme.
    13·1 answer
  • Services such as water, electricity, and phone communications are called:
    7·1 answer
  • JAVA
    12·1 answer
  • The data _____ component of a database management system (DBMS) is used to create and maintain the data dictionary. manipulation
    14·1 answer
  • Supplies/material used in iron​
    11·1 answer
  • Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!