OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1270
FORMULA
EXAMPLE
{q, q+2} = {17, 19} is the 4th twin-pair and prime(19) - prime(17) = 67 - 59 = 8, so a(4) = 8.
MATHEMATICA
{ta=Table[0, {1300}], tb=Table[0, {1300}], tc=Table[0, {1300}], u=1}; Do[s=Prime[n+1]-Prime[n]; If[Equal[s, 2], ta[[u]]=Prime[Prime[n+1]]-Prime[Prime[n]]; tb[[u]]=n; tc[[u]]=Prime[n]; u=u+1], {n, 1, 10000}]; ta
Prime[#[[2]]]-Prime[#[[1]]]&/@Select[Partition[Prime[Range[500]], 2, 1], #[[2]]-#[[1]]==2&] (* Harvey P. Dale, Dec 26 2023 *)
PROG
(PARI) lista(nn) = {forprime(q=2, nn, if (isprime(q+2), print1(prime(q+2)-prime(q), ", ")); ); } \\ Michel Marcus, Jul 27 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Jun 23 2004
STATUS
approved