4 ms·
The coolest technique I know of for checking primes is a variant of the Lucas sequence method (which is what GIMPS uses to find Mersenne primes)[1]. Essentially
by cyphar 11y ago
The coolest technique I know of for checking primes is a variant of the Lucas sequence method (which is what GIMPS uses to find Mersenne primes)[1]. Essentially, you generate terms in a sequence in a constant-memory fashion that doesn't require you to know the factors, using just a modulo in a generating function.
[1]: https://www.youtube.com/watch?v=lEvXcTYqtKU https://www.youtube.com/watch?v=lEvXcTYqtKU