Python 60: improve performance by caching primes.
Tidy python 60.