Question: Use python to work backwards in twin prime numbers. Given a number (not too big, we'll talk about that in a advanced class) report if

Use python to work backwards in twin prime numbers. Given a number (not too big, we'll talk about that in a advanced class) report if it is a prime number. Do this by modifying the code given. DO NOT use the Sieve of Eratosthenes.

Code given:

import math

sum = 0

i = 2

while sum <50:

i = i + 1

is_prime = True

for j in range(2, int(math.sqrt(i)+1)):

if i % j == 0:

is_prime = False

if is_prime:

print(i)

sum = sum + 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!