login
The first of two consecutive primes the sum of which is equal to the sum of two consecutive pentagonal numbers.
5

%I #12 Jan 22 2018 03:20:38

%S 79,3643,10909,37123,56053,70849,78889,125551,178877,209063,258743,

%T 330409,350411,395261,439559,469279,479387,499969,620813,663997,

%U 754723,828811,878597,901709,1026709,1087147,1170397,1202429,1213189,1234873,1340477,1510013

%N The first of two consecutive primes the sum of which is equal to the sum of two consecutive pentagonal numbers.

%H Chai Wah Wu, <a href="/A298464/b298464.txt">Table of n, a(n) for n = 1..10000</a>

%e 79 is in the sequence because 79+83 (consecutive primes) = 162 = 70+92 (consecutive pentagonal numbers).

%t Block[{s = Total /@ Partition[PolygonalNumber[5, Range[10^3]], 2, 1], t}, t = Partition[Prime@ Range@ PrimePi[2 Last[s]], 2, 1]; Select[t, MemberQ[s, Total@ #] &][[All, 1]]] (* _Michael De Vlieger_, Jan 21 2018 *)

%o (PARI) L=List(); forprime(p=2, 1600000, q=nextprime(p+1); t=p+q; if(issquare(12*t-8, &sq) && (sq-2)%6==0, u=(sq-2)\6; listput(L, p))); Vec(L)

%o (Python)

%o from __future__ import division

%o from sympy import prevprime, nextprime

%o A298464_list, n, m = [], 1 ,6

%o while len(A298464_list) < 10000:

%o k = prevprime(m//2)

%o if k + nextprime(k) == m:

%o A298464_list.append(k)

%o n += 1

%o m += 6*n-1 # _Chai Wah Wu_, Jan 20 2018

%Y Cf. A000040, A000326, A061275, A298462, A298463, A298465, A298466.

%K nonn

%O 1,1

%A _Colin Barker_, Jan 19 2018