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]
2 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]2 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
Amy wants to make an exact replica of a specific area in an image. Which tool Amy will use?
ipn [44]

Answer:

Explanation:

.

4 0
3 years ago
Liam noticed someone had accessed his social media account and made several posts without his knowledge. Which of the following
jok3333 [9.3K]

Answer:

Liam could

1) Change the password

Be sure to change the password to a "strong" one (containing lots of characters, numbers, symbols) so that way the password would be difficult to guess.

2) Avoid logging onto social media on public computers or WiFi connections.

Using public WiFi leaves you vulnerable to someone accessing your information through Internet traffic. If you do use public computers, just make sure to log out.

3) Avoid giving out account information to friends and avoid opening suspicious links and emails.

Opening suspicious links or emails could allow malware to infect your computer the moment you open them. Friends can unknowingly share these links that are designed to steal information.

I hope this helped <3 please lmk if there's anything more to add.

4 0
3 years ago
The excessive use of the internet and the web for personal use at work is sometimes called ____ .
Elodia [21]
This is called Cyberslacking
7 0
3 years ago
Read 2 more answers
Which part of a computer is responsible for executing the software programs?
mamaluj [8]

Answer:

c. CPU

Explanation:

7 0
3 years ago
1.6<br> What do you call the two parts of the lift that goes down a mine?
Likurg_2 [28]

Answer:

Sheave wheel and hoist cable

Explanation:

The sheave wheel is a pulley wheel that sits above the mine shaft. The hoist cable passes over the sheave wheel and then down the shaft of the mine. The sheave wheel reduces the sliding friction of the mine cable. The head frame is the structure that supports the sheave wheel.

7 0
3 years ago
Other questions:
  • What economic measure is at the highest level since the Great Depression?
    12·1 answer
  • The _____ contains a series of sections designed to prepare students for the ACT
    14·2 answers
  • Which unit of measurement related to quantity
    12·2 answers
  • What are the three modes of the 3D transform manipulator
    12·1 answer
  • What is the single most important component of a computer? Central Processing Unit DIP Motherboard Chipset
    8·1 answer
  • In Java, it is possible to create an infinite loop out of while and do loops, but not for-loops. true or false
    11·1 answer
  • What is the different between ethical and legal issues?​
    6·1 answer
  • Which tool will select the lines of a sketch in digital software?
    7·1 answer
  • Anyone know how to delete that I need ASAP
    13·1 answer
  • In order to get the maximum functionality out of a device that is plugged in, a user should download the specific ___ for that d
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!