Ask HN: How can I check if a large number is prime?
I was looking at a list of prime numbers in binary format and I noticed a pattern, where if 2^n - 1, a Mersenne Prime, is in the list, then (2^(n+1) - 2^(n) - 1) is also in the list.
I looked at the list of Mersenne Primes on Wikipedia and checked the primality of (2^43112610 - 2^43112609 - 1) on Wolfram Alpha, but to test for any results larger than that, the results are inconclusive.
The largest discovered prime number is a Mersenne Prime (2^82589933 − 1), so I'm wondering how I can go about testing (2^82589934 - 2^82589933 − 1). > I was looking at a list of prime numbers in binary format and I noticed a pattern, where if 2^n - 1, a Mersenne Prime, is in the list, then (2^(n+1) - 2^(n) - 1) is also in the list. That’s because both are equal. We have Oh my goodness, you're right... Ummm, did you look into https://en.wikipedia.org/wiki/Primality_test ? Haven't kept up with cryptography research but I think msieve is still the current state of the art integer factorization software that's open source
so 2^(n+1) = 2 × 2^(n) = 2^(n) + 2^(n)
2^(n+1) - 2^(n) - 1
= 2^(n) + 2^(n) - 2^(n) - 1
= 2^(n) - 1