|
COMMENT
|
Pi_n(a(n)/a(n): 0.66667, 0.40000, 0.25801, 0.2145966850
3=3, 10=2*5, 9837=3*3*1093 & 251179584927=3*271*1753*176243.
3 is the second prime, 10 is the fourth semiprime, 9837 is the trieneprime and 251179584927 is the 4-almost prime.
|
|
MATHEMATICA
|
AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W.Weisstein (eww(AT)wolfram.com) Feb 07 2006 *)
fQ[n_] := Plus @@ Last /@ FactorInteger@n == 4; c = r = 0; Do[If[fQ@n, c++ ]; If[c/n > r, Print[n]; r = c/n], {n, 10^6}]
|