Rewrote #prime? to be significantly faster.