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
Get step-by-step solutions from verified subject matter experts
