Optimized the prime finding code. The average time for the 100000th prime is 0.112 seconds.