Update
Is there any better way of generating the nth prime power?
Chip Hurst gave a great solution for a list below, so
PrimePowersUpTo[x_] := Union @@ Table[Prime[Range[PrimePi[x^(1/n)]]]^n, {n, Log2[x]}]
pp=PrimePowersUpTo[10^7];
pp[[n]]
would work, but I was wondering whether there was a more direct way?
Original question
I am trying to get a list of prime powers, but I can only seem to get one that goesx to 10^7.
xmax = 10000000;
rr = DeleteCases[Table[If[PrimePowerQ[n] == True, n, 0], {n, 1, xmax}], 0];
or
Select[Range[10], PrimePowerQ]
I tried using Artes' idea of taking log base prime as per here, but didn't get very far.
Is there any way I can go to 10^12?
PrimePi[10^12]
is a very large number ... $\endgroup$PrimePi
withRiemannR
even if Mathematica implementation doesn't help, e.g.RiemannR[10^12] // N
yields3.76079*10^10
. See also Approximation to the prime counting function. $\endgroup$