login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A298465 The first of two consecutive heptagonal numbers the sum of which is equal to the sum of two consecutive primes. 5
1, 18, 403, 16281, 24354, 167314, 172528, 183196, 191407, 223054, 413512, 446688, 476767, 507826, 512343, 791578, 926289, 994456, 1032658, 1248562, 1284147, 2221708, 2278630, 2453716, 2604571, 2738952, 2770443, 3207523, 3333330, 4203577, 4400332, 4628761 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
18 is in the sequence because 18+34 (consecutive heptagonal numbers) = 52 = 23+29 (consecutive primes).
MATHEMATICA
chcpQ[{a_, b_}]:=Module[{c=(a+b)/2}, NextPrime[c]+ NextPrime[c, -1] ==a+b]; Select[ Partition[PolygonalNumber[7, Range[2000]], 2, 1], chcpQ][[;; , 1]] (* Harvey P. Dale, Mar 14 2023 *)
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, (5*u^2-3*u)/2))); Vec(L)
(Python)
from sympy import prevprime, nextprime
A298465_list, n, m = [], 1 , 8
while len(A298465_list) < 10000:
k = prevprime(m//2)
if k + nextprime(k) == m:
A298465_list.append(n*(5*n-3)//2)
n += 1
m += 10*n-3 # Chai Wah Wu, Jan 19 2018
CROSSREFS
Sequence in context: A159647 A111454 A116421 * A260655 A318598 A215229
KEYWORD
nonn
AUTHOR
Colin Barker, Jan 19 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 16:08 EDT 2024. Contains 371794 sequences. (Running on oeis4.)