Deriving this recursive expression for Riemann Prime Counting Function?

138 Views Asked by At

Why does this work?

$f(n,k,1)=0$
$f(n,k,j)= \frac{1}{k} - f(\lfloor\frac{n}{j}\rfloor, k+1, \lfloor\frac{n}{j}\rfloor) + f(n,k,j-1)$

Here, f(n,1,n) computes the Riemann Prime Counting Function. Try f(100,1,100), you get 28.5333333.....

You can see it work in Mathematica like so:

f[n_, k_, 1] := 0
f[n_, k_, j_] := 1/k - f[Floor[n/j], k + 1, Floor[n/j]] + f[n, k, j - 1]
DiscretePlot[f[n, 1, n], {n, 2, 100}]

(the Riemann Prime Counting Function is the usual $f(n) = \pi(n) + \frac{1}{2}\pi(n^\frac{1}{2})+ \frac{1}{3}\pi(n^\frac{1}{3})+ \frac{1}{4}\pi(n^\frac{1}{4})...$)