sum of first 1000 primes
cycle detection