Added improved n+1.
Fixed bug in is_prime.
Revert test code.