What are Mersenne Numbers?
Mersenne Numbers are numbers represented in the form of 2^n - 1.
Like :
2^1-1 , 2^2-1 , 2^3-1 , and many more.
It appears a simple to-do task.
It appears much simple in python too.
Let's get started.
We will try to find out the first 10 Mersenne Numbers using Python3:
n = int(input("Enter the Limit: "))
mersnum = 0
for i in range(1,n+1):
mersnum = 2**i - 1
print(mersnum)
0 Comments