OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
2 is in the sequence because 2*2*(2+1) = 5+7 = 12.
3 is in the sequence because 2*3*(3+1) = 11+13 = 24.
5 is in the sequence because 2*5*(5+1) = 29+31 = 60.
7 is in the sequence because 2*7*(7+1) = 53+59 = 112.
23 is in the sequence because 2*23*(23+1) = 547+557 = 1104.
MAPLE
a:= proc(n) option remember; local p, t;
p:= `if`(n=1, 1, a(n-1));
do p:= nextprime(p);
t:= p*(p+1);
if prevprime(t)+nextprime(t)=2*t then return p fi
od
end:
seq(a(n), n=1..60); # Alois P. Heinz, Mar 19 2012
MATHEMATICA
a[n_] := a[n] = Module[{p, t}, p = If[n==1, 1, a[n-1]]; While[True, p = NextPrime[p]; t = p(p+1); If[NextPrime[t, -1] + NextPrime[t]==2t, Return[p]]]];
Array[a, 60] (* Jean-François Alcover, Nov 20 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerasimov Sergey, Mar 17 2012
STATUS
approved