I'm making a program that changes the value of n (in the equation of E = n^2 + n + 5) and predicts the probability that E will be prime. Here is my code:
n = 0
t = 0
p = 0
while 3 > 2:
nn = n*n
E = nn + n + 5
n = n + 1
if E > 1:
for i in range(2, E):
if((E % i) == 0):
print(E, "is not prime when n =", n)
else:
print("Found a prime!", E, "when n =", n)
t = t + 1
print(t)
if(t >= 50):
break
fraction = p/t
print(p)
print(t)
percent_int = fraction*100
percent = int(percent_int)
print("The rounded probability of getting a prime number is:", percent_int, "%")
However, the program isnt working. It always says that the probability of getting a prime is 0%, when I know that it isnt (n=1 produces a prime number).