If you need to generate primes from 1 to N, the \"dumb\" way to do it would be to iterate through all the numbers from 2 to N and check if the numbers are divisable by any p
http://en.wikipedia.org/wiki/Prime_number#Number_of_prime_numbers_below_a_given_number
i/log(i) ~= N/log(N)
N/i ~= 1
Multiply by roughly N/log(N) prime numbers.
N/log(N)