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
Which is a type of artificial neural network (ann) that includes many layers to deal with complex problems that may have very la
STALIN [3.7K]

Answer:

Deep Learning

Explanation:

7 0
2 years ago
Which of the following is a Windows feature that allows you to temporarily store next text
LUCKY_DIMON [66]
You didn't give the options for us to choose from. But I do think I know what you are talking about. It is "Clipboard".
6 0
3 years ago
Which of the following statements about crane hand signal training are true? A. Both statements are true about crane hand signal
Alenkinab [10]
The correct option is A.
When using crane at a construction site, it is required that:
1.A poster should be posted at the job site with an illustration of the hand signals that every operator and personnel working with the crane and around the crane must know.
2. Hand signals for crane and derrick operators should be those set by the American National Standard institute customize for the type of crane in use.<span />
5 0
3 years ago
What should you do when an error message pops up on the screen?
Shtirlitz [24]
The best thing to do when an error message appears when it is not supposed to, as in if you are blocked by an administrator and it appears then its supposed to, it is best to contact someone who can investigate whether or not something is happening to your computer. That could be a parent, if they are good with computers, or just tech support at a store, provided they also know computers. Most of the time your computer just makes a mistake so nothing to worry about, but make sure to have it checked just to be sure. 
7 0
3 years ago
What is the Load in a flashlight? Give two other examples of “Loads”. plz help me
Arlecino [84]

Answer:

Like a load of batteries

Explanation:

" I have a load of crayons", "I found a load of tires". Hope this helps

4 0
3 years ago
Other questions:
  • Which of the descriptions listed below best describes the step in the reverse engineering process called functional analysis? A)
    12·1 answer
  • A network administrator has been given a network of 172.16.85.0/21 and wants to know the usable range of IP addresses on that su
    13·1 answer
  • Mike needs to write the primary objectives of a project in a project plan. In which section should he write them?
    6·1 answer
  • Who is the last person appointed to the u.s supreme court
    11·1 answer
  • What are the advantages of Napier bones?​
    15·1 answer
  • Describe at least two other companies that are direct or indirect competitors to your company. Explain how you will differentiat
    15·1 answer
  • Which of the following is not considered a system component that can be found inside a computer? A-CPU B-RAM C-PCIe graphics ada
    6·1 answer
  • Which is a concept of the CIA of Computer Security
    7·1 answer
  • Which device is used to direct the flow of data on a computer network?
    13·1 answer
  • By default word documents include _______ margins on all sides of the document.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!