|
MATHEMATICA
|
nextSemiPrime[n_] := Block[{k = n + 1}, While[ Plus @@ Last /@ FactorInteger@ k != 2, k++]; k]; c = 1; k = 4; lst = {}; While[k < 8100000000, If[ Mod[k, 10^Floor[1 + Log10@ c]] == c, AppendTo[lst, k]; Print[{c, k}]]; c++; k = nextSemiPrime@ k]; lst
These terms can be crosschecked by: SemiPrimePi[n_] := Sum[ PrimePi[n/Prime@ i] -i + 1, {i, PrimePi@ Sqrt@ n}]
|