Integer odds and prime numbers
by John from John D. Cook on (#41233)
For every integer m > 1, it's possible to choose N so that the proportion of primes in the sequence 1, 2, 3, " N is 1/m. To put it another way, you can make the odds against one of the first N natural numbers being prime any integer value you'd like [1].
For example, suppose you wanted to find N so that 1/7 of the first N positive integers are prime. Then the following Python code shows you could pick N = 3059.
from sympy import primepi m = 7 N = 2*m while N / primepi(N) != m: N += m print(N)Related posts
[1] Solomon Golomb. On the Ratio of N to I(N). The American Mathematical Monthly, Vol. 69, No. 1 (Jan., 1962), pp. 36-37.
The proof is short, and doesn't particularly depend on the distribution of primes. Golomb proves a more general theorem for any class of integers whose density goes to zero.