Below is the code which shows Prime numbers and Mersenne Prime Numbers. It also spits out the last digit of a long number which could be prime or not. I would like the number range, "stop" to be used for user input. Any help thank you.
code part which I don't understand how to incorporate user input:
code part which I don't understand how to incorporate user input:
for num in range(3,30,2):
import math # Python program to check if the input number is prime or not def isPrime(num): for i in range(2, int(math.sqrt(num)+1)): if num % i == 0: return False; return num>1; print 2 print 3 print 3 print ("______________") for num in range(3,30,2): if isPrime(num): if all(num%i!=0 for i in range(3,int(math.sqrt(num))+1, 2)): print num print ((2**num-1)*(2**num)/2)/(2**num)*2+1 print ((((2**num-1)*(2**num)/2)/(2**num)*2+1+1)%10)-1 print ("______________")