login
A298466
The first of two consecutive primes the sum of which is equal to the sum of two consecutive heptagonal numbers.
5
3, 23, 433, 16481, 24593, 167953, 173183, 183871, 192097, 223781, 414521, 447743, 477857, 508951, 513473, 792983, 927803, 996019, 1034251, 1250309, 1285937, 2224063, 2281003, 2456191, 2607109, 2741561, 2773073, 3210353, 3336209, 4206817, 4403647, 4632161
OFFSET
1,1
EXAMPLE
23 is in the sequence because 23+29 (consecutive primes) = 52 = 18+34 (consecutive heptagonal numbers).
MATHEMATICA
Module[{hep=Total/@Partition[PolygonalNumber[7, Range[1500]], 2, 1]}, Select[ Partition[Prime[Range[PrimePi[Max[hep]/2]]], 2, 1], MemberQ[hep, Total[#]]&]][[All, 1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 04 2019 *)
PROG
(PARI) L=List(); forprime(p=2, 6000000, q=nextprime(p+1); t=p+q; if(issquare(20*t-16, &sq) && (sq-2)%10==0, u=(sq-2)\10; listput(L, p))); Vec(L)
(Python)
from sympy import prevprime, nextprime
A298466_list, n, m = [], 1 , 8
while len(A298466_list) < 10000:
k = prevprime(m//2)
if k + nextprime(k) == m:
A298466_list.append(k)
n += 1
m += 10*n-3 # Chai Wah Wu, Jan 19 2018
KEYWORD
nonn
AUTHOR
Colin Barker, Jan 19 2018
STATUS
approved