Main loop now uses generate_next_prime() instead of skipping evens. Code is still confusing and needs refactoring.