1
0
www.mikescher.com/www/statics/euler/Euler_Problem-058_explanation.md
Mike Schwörer a049dec2e0
Some checks failed
Build Docker and Deploy / Deploy to Server (push) Blocked by required conditions
Build Docker and Deploy / Build Docker (push) Has been cancelled
replace mathblog.dk links with waybackmachine
2025-03-30 23:43:38 +02:00

4 lines
501 B
Markdown

It's obvious that the bottleneck of this program is the primality test.
The numbers become here too big to create a sieve and "normal" prime testing takes too long.
So we use the [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller-Rabin_primality_test) that I implemented a while ago (thank [mathblog.dk](https://web.archive.org/web/20150314052138/http://www.mathblog.dk/project-euler-58-primes-diagonals-spiral/)).
The rest is just enumerating all the diagonals until `primes*10<all`