422 B
422 B
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 that I implemented a while ago (thank mathblog.dk).
The rest is just enumerating all the diagonals until primes*10<all