OFFSET
1,1
COMMENTS
Or least integer k such that prime(k+2) - prime(k+1) = 2n where prime(k) is in A001359 (lesser of twin primes).
The corresponding prime(k) are 3, 5, 29, 137, 197, 1931, 521, 1949, 1667, 2969, 7757, 12161, 28349, 20807, ...
a(n) = 0 for n == 1 mod 3 for n > 1.
Proof: prime(k+1) - prime(k) = 2 => prime(k+1) == 1 mod 6 and prime(k) == -1 mod 6. If prime(k+2) - prime(k+1) = 2n, then prime(k+2) = 2(n+1) + prime(k). Combining n == 1 mod 3 and prime(k) == -1 mod 6 we obtain prime(k+2) == 3 mod 6, a contradiction because prime(k+2) == +-1 mod 6. Hence, a(n) = 0.
EXAMPLE
a(3) = 10 because prime(11) - prime(10) = 31 - 29 = 2 and prime(12) - prime(11) = 37 - 31 = 6 = 2*3.
a(11) = 296 because prime(297) - prime(296) = 1951 - 1949 = 2 and prime(298) - prime(297) = 1973 - 1951 = 22 = 2*11.
MAPLE
nn:=50:m:=10^5:
for n from 1 to 50 do:
ii:=0:
for k from 1 to m while(ii=0) do:
p1:=ithprime(k):p2:=ithprime(k+1):p3:=ithprime(k+2):
if p2-p1 = 2 and p3-p2 = 2*n
then
ii:=1:printf(`%d %d \n`, n, k):
else
fi:
od:
if ii=0 then printf(`%d %d \n`, n, 0):
else
fi:
od:
MATHEMATICA
Table[If[And[n > 1, Mod[n, 3] == 1], 0, k = 1; While[Nand[# - Prime@ k == 2, Prime[k + 2] - # == 2 n] &@ Prime[k + 1], k++]; k], {n, 40}] (* Michael De Vlieger, Jan 14 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 11 2017
STATUS
approved