Faster prime sieve.  Code cleanup.
Solved a bunch more problems plus code cleanup