This I did also after 'spying' discussions in other forum. Of course you would use sieve prime generation for bigger numbers, but I proved other simple way for a change. Slightly more advanced primes list generator would use primes % 6 in (1,5) property: [CODE]def primes(n): """ primitive non-sieve prime finder """ p = [2, 3] candidate, step = 5, 2 while candidate <= n: if all(candidate % pr for pr in p): p.append(candidate) candidate += step # consider only number % 6 in (1,5) ie 6*n +- 1 step = 2 if step == 4 else 4 return p …

Member Avatar
Member Avatar
+0 forum 1

The End.