result of my prime counting function

Mar 2019
318
14
iran
for n=100000 p=317 and q=99991 when did we calculate it?
 
Aug 2012
2,488
780
for n=100000 p=317 and q=99991 when did we calculate it?
How did "we" get enlisted for this project? It's five lines of Python.

Code:
Primes = [101, 103, etc.]  # You fill in the primes you care about.

product = 1
for prime in Primes :
    product *= ((prime - 1)/prime)    
print(str(product))
You initialize a list called Primes with the list of primes, which you can look up or calculate.

ps -- This is Python3, which defines '/' as real number division.
 
Last edited:
Mar 2019
318
14
iran
proof
1/2 × 2/3 × 4/5 × ... × (p-1)/p = Π (p-1)/p = Π 1-(1/p) = Π 1-p^(-1) = 1/(Π 1/(1-p^(-1))) = 1/zeta(1) = 1/( 1+1/2+1/3+...+1/p) = 1/ln(p)
q=p^2
1/2 × 2/3 × 4/5 × ... × (q-1)/q = 1/ln(q)
=> (p-1)/p × ... × (q-1)/q = 1/ln(q) / 1/ln(p) = 1/ln(p^2) / 1/ln(p) = 1/2