Refactor the first prime index.
Only count successful generations.
Remove unused BIGNUMs.
Add a test to check we're really generating probable primes.