OFFSET
1,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Colin Barker, Jan 19 2018
STATUS
approved