login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A074038
If n is the k-th single (i.e., non-twin) prime then a(n) = k, otherwise a(n) = 0.
3
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0
OFFSET
1,23
LINKS
FORMULA
A007510(a(n)) = n.
MATHEMATICA
upto = 100;
A074038list[upto_] := Module[{k = 0, v = Table[0, {upto}], n},
For[n = 1, n <= upto, n++, If[PrimeQ[n] && (2 == n ||
((!PrimeQ[n-2]) && (!PrimeQ[n+2]))), k++; v[[n]] = k,
v[[n]] = 0]]; v];
v074038 = A074038list[upto];
a[n_] := v074038[[n]];
Table[a[n], {n, 1, upto}] (* Jean-François Alcover, Dec 03 2021, after PARI code *)
PROG
(PARI)
up_to = 65537;
A074038list(up_to) = { my(k=0, v=vector(up_to)); for(n=1, up_to, if(isprime(n)&&(2==n||((!isprime(n-2))&&(!isprime(n+2)))), k++; v[n]=k, v[n] = 0)); (v); };
v074038 = A074038list(up_to);
A074038(n) = v074038[n];
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 13 2002
STATUS
approved