login
Primes p such that 2p*(p+1) is the sum of 2 successive primes.
1

%I #22 Nov 20 2020 09:00:40

%S 2,3,5,7,23,29,41,59,79,89,101,131,139,151,197,229,317,337,347,389,

%T 397,421,479,631,743,761,821,829,953,977,1033,1193,1279,1451,1697,

%U 1747,1787,1789,1879,1997,1999,2017,2099,2213,2237,2347,2411,2477,2579,2621,2663

%N Primes p such that 2p*(p+1) is the sum of 2 successive primes.

%H Alois P. Heinz, <a href="/A210110/b210110.txt">Table of n, a(n) for n = 1..1000</a>

%e 2 is in the sequence because 2*2*(2+1) = 5+7 = 12.

%e 3 is in the sequence because 2*3*(3+1) = 11+13 = 24.

%e 5 is in the sequence because 2*5*(5+1) = 29+31 = 60.

%e 7 is in the sequence because 2*7*(7+1) = 53+59 = 112.

%e 23 is in the sequence because 2*23*(23+1) = 547+557 = 1104.

%p a:= proc(n) option remember; local p, t;

%p p:= `if`(n=1, 1, a(n-1));

%p do p:= nextprime(p);

%p t:= p*(p+1);

%p if prevprime(t)+nextprime(t)=2*t then return p fi

%p od

%p end:

%p seq(a(n), n=1..60); # _Alois P. Heinz_, Mar 19 2012

%t 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]]]];

%t Array[a, 60] (* _Jean-François Alcover_, Nov 20 2020, after _Alois P. Heinz_ *)

%Y Cf. A001043.

%K nonn

%O 1,1

%A _Gerasimov Sergey_, Mar 17 2012