OFFSET
1,1
COMMENTS
Primes in this sequence include a(12) = 223, a(23) = 439, a(25) = 479, a(43) = 823, a(45) = 857, a(47) = 887, a(49) = 929.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Almost Prime.
EXAMPLE
a(1) = prime(1) + semiprime(1) + 3almostprime(1) + 4almostprime(1) = 2 + 4 + 8 + 16 = 30.
a(6) = (prime(6) + semiprime(6) + 3almostprime(6)) + 4almostprime(6) = A114382(6) + 4almostprime(6) = 56 + 56 = 112.
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, Feb 07 2006 *)
AlmostPrime[k_, n_] := Block[{e = Floor[Log[2, n]], a, b}, a = 2^e; Do[b = 2^p; While[AlmostPrimePi[k, a] < n, a = a + b]; a = a - b/2, {p, e, 0, -1}]; a + b/2]; Table[ Sum[ AlmostPrime[k, n], {k, 4}], {n, 52}] (* Robert G. Wilson v, Feb 21 2006 *)
nn=500; Module[{p=Prime[Range[nn]], p2=Select[Range[nn], PrimeOmega[#] == 2&], p3=Select[Range[nn], PrimeOmega[#] ==3&], p4 =Select[Range[nn], PrimeOmega[#]==4&], len}, len=Min[Length/@{p, p2, p3, p4}]; Total/@Thread[ {Take[p, len], Take[p2, len], Take[p3, len], Take[p4, len]}]] (* Harvey P. Dale, Jul 13 2012 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Feb 20 2006
EXTENSIONS
Corrected by Harvey P. Dale, Jul 13 2012
STATUS
approved