Apr-24-2018, 06:41 PM
(Apr-24-2018, 07:46 AM)Pleiades Wrote: Hi all, Great thanks for this site it helps. Anyway I have found a direct relationship with perfect numbers to Mersenne Numbers. For Instance 6 is a perfect Number and it is divisible by two which equals 3. My current formula is looking at exponents of the number 4. If you want to find Mersenne numbers than put an exponent on 4 double the number and substract 1. However the exponents are staggered at times. but if you do it enough you will land a Mersenne number. 28 is a perfect number divide it by 7 and you get 4. Lets look at 4^3=64 next 2*64-1=127 Lets look at 4^6=4096 next 2*4096-1=8191 try 4^15 I need some code that will process large perfect numbers. Thanks for reading :)Ok I'm getting somewhere I'm finding Mersennes in this code. However can you guys help me plz with a small script which finds the P associated with the mersenne. 2^p-1 thank you.
# Python Program to display the powers of 2 using anonymous function # Change this value for a different result terms = 60 # Uncomment to take number of terms from user #terms = int(input("How many terms? ")) # use anonymous function result = list(map(lambda x: 4 ** x*2-1, range(terms))) # display the result print("The total terms is:",terms) for i in range(terms): print("4 raised to power",i,"is",result[i])