solved problem 10 in the same manner I solved problem 7 - with a
boatload of precomputed primes