A241658 Smallest semiprime, sp, such that n - sp is a semiprime, or a(n)=0 if there is no such sp.
0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 6, 4, 4, 6, 6, 0, 4, 4, 6, 6, 0, 9, 9, 4, 4, 6, 6, 4, 4, 6, 6, 0, 9, 9, 10, 4, 4, 4, 6, 6, 4, 4, 6, 6, 21, 9, 9, 10, 4, 25, 6, 4, 15, 4, 10, 6, 9, 4, 9, 4, 4, 6, 6, 10, 4, 9, 6, 4, 15, 6, 10, 4, 9, 6, 14, 15, 4, 10, 6, 4, 25, 6, 10, 34, 4, 10, 6, 4, 4
Offset: 1
Keywords
Examples
a(23) = 9 because 23 = 9 + 14, two semiprimes.
Programs
-
Mathematica
NextSemiPrime[n_, k_: 1] := Block[{c = 0, sgn = Sign[k]}, sp = n + sgn; While[c < Abs[k], While[ PrimeOmega[sp] != 2, If[ sgn < 0, sp--, sp++]]; If[ sgn < 0, sp--, sp++]; c++]; sp + If[sgn < 0, 1, -1]]; f[n_] := Block[{sp = 4}, While[ PrimeOmega[n - sp] != 2, sp = NextSemiPrime[sp]]; If[n > sp, sp, 0]]; Array[ f, 90]
-
PARI
a(n) = {for (k=4, n-4, if ((bigomega(k) ==2) && (bigomega(n-k) == 2), return (k));); return (0);} \\ Michel Marcus, Jun 12 2014
Comments