Difference between revisions of "ZCubes/Mersenne Primes and Perfect Numbers"
Jump to navigation
Jump to search
(Created page with "==Mersenne Primes and Perfect Numbers== <br/> Mersenne prime is a prime number that is one less than a power of two. That is, it is a prime number of the form 2n − 1 for som...") |
(→Video) |
||
Line 8: | Line 8: | ||
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | ||
+ | ==Code== | ||
+ | a=2n^(1..700); | ||
+ | units.on; | ||
+ | a.$(x=>[x,x-1n,(ISPRIME(x<>n-1n))]) | ||
+ | .filter(r=>r[0][2]) | ||
+ | |||
+ | 1..10000 | ||
+ | .filter(n=>SUM(PROPERDIVISORS(n))==n) | ||
+ | |||
+ | [3,7,31,127,8191,131071].$(""x*(x+1)/2"")" | ||
Revision as of 02:34, 24 March 2020
Mersenne Primes and Perfect Numbers
Mersenne prime is a prime number that is one less than a power of two. That is, it is a prime number of the form 2n − 1 for some integer n. There are also connected to perfect numbers. The largest known prime number, 282,589,933 − 1, is a Mersenne prime. Finding Mersenne prime and validating it is a computation intensive task. This video demonstrates how to generate Mersenne primes using ZCubes, and will also explore the relationship with Perfect numbers.
Video
Code
a=2n^(1..700); units.on; a.$(x=>[x,x-1n,(ISPRIME(x<>n-1n))]) .filter(r=>r[0][2])
1..10000 .filter(n=>SUM(PROPERDIVISORS(n))==n)
[3,7,31,127,8191,131071].$(""x*(x+1)/2"")"
<< Learn ZCubes
© Copyright 1996-2020, ZCubes, Inc.