# Create a function for $\Pi^{-1}(n)$

Is it possible to create a function that gives the inverse of

pP[x_] := Sum[PrimePi[x^(1/k)]/k, {k, 1, Floor[Log2[x]]}]


i.e., a function that plots

{pP@#, #} & /@ Range@(InverseFunction[LogIntegral]) // ListLinePlot


but is a function in $n$ that gives the actual value of $\Pi^{-1}(n)$ for any $n?$

• your pP only returns a set of discrete rational results. What should the inverse be if evaluated for an x not in the set of allowable values? Sep 24, 2015 at 15:18
• @george2079 this is the problem I am facing - intervals should evaluate to the same as the previous value change, but I have no idea how to manage this. Sep 24, 2015 at 15:20

This is an approximation*:

inv = Interpolation[
DeleteDuplicates[
Table[ {pP[x], x}, {x, 1, 400, .01}] , (#1[] == #2[]) & ],
InterpolationOrder -> 0];

Plot[ inv[x], {x, 0, 80}] The issue now is how to find the exact x where the jumps occur..

*After looking at the results the jumps seem to always occur at integer x, so you can drop the .01 increment to speed things up (and I suppose call it exact )

• nice, thanks :) a little slow on my machine - but I suppose that is unavoidable? - Ah, I see, it is the initial calculation to the desired height that is slow - so this function is essentially an interpolation of a lookup table - great - will have a oplay around with it - thanks again :) Sep 24, 2015 at 15:40