Write a Python script that display 20 Mersenne Prime Numbers ?
Answers
Answered by
1
The python script that displays 20 Mersenne Prime numbers is
def Mersenne (n):
return 2** n-1
def test prime (n):
mid = n/2 + 1
for t in range (2, mid):
if n%t = = 0:
return false else :
return true
print “20 Mersenne Prime Numbers are :” for a in range (1,21):
number = Mersenne (a)
prime = test prime (number)
if prime : print number, “Prime”
else : print number
Answered by
0
Python Program to Print all Prime Numbers between an Interval:-
- #Take the input from the user:
- lower = int(input("Enter lower range: "))
- upper = int(input("Enter upper range: "))
- for num in range(lower,upper + 1):
- if num > 1:
- for i in range(2,num):
- if (num % i) == 0:
- break.
➳ ᴹⁱˢˢ✰᭄Iɴɴᴏᴄᴇɴᴛ❀࿐
Similar questions
Biology,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
English,
1 year ago