Complete loop. Working and checked first 1000 primes.