Settings

Theme

Ask HN: How can I check if a large number is prime?

3 points by Kibae 3 years ago · 4 comments · 1 min read


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).

Someone 3 years ago

> 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

  2^(n+1) = 2 × 2^(n) = 2^(n) + 2^(n)
so

  2^(n+1) - 2^(n) - 1
  = 2^(n) + 2^(n) - 2^(n) - 1
  = 2^(n) - 1
InterNautic 3 years ago

Ummm, did you look into https://en.wikipedia.org/wiki/Primality_test ?

trinovantes 3 years ago

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

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection