Faster getNextPrime()

Uses fewer instructions and no member variables