cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A298465 The first of two consecutive heptagonal numbers the sum of which is equal to the sum of two consecutive primes.

This page as a plain text file.
%I A298465 #15 Oct 12 2023 13:38:32
%S A298465 1,18,403,16281,24354,167314,172528,183196,191407,223054,413512,
%T A298465 446688,476767,507826,512343,791578,926289,994456,1032658,1248562,
%U A298465 1284147,2221708,2278630,2453716,2604571,2738952,2770443,3207523,3333330,4203577,4400332,4628761
%N A298465 The first of two consecutive heptagonal numbers the sum of which is equal to the sum of two consecutive primes.
%H A298465 Chai Wah Wu, <a href="/A298465/b298465.txt">Table of n, a(n) for n = 1..10000</a>
%e A298465 18 is in the sequence because 18+34 (consecutive heptagonal numbers) = 52 = 23+29 (consecutive primes).
%t A298465 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 *)
%o A298465 (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)
%o A298465 (Python)
%o A298465 from sympy import prevprime, nextprime
%o A298465 A298465_list, n, m = [], 1 ,8
%o A298465 while len(A298465_list) < 10000:
%o A298465     k = prevprime(m//2)
%o A298465     if k + nextprime(k) == m:
%o A298465         A298465_list.append(n*(5*n-3)//2)
%o A298465     n += 1
%o A298465     m += 10*n-3 # _Chai Wah Wu_, Jan 19 2018
%Y A298465 Cf. A000040, A000566, A061275, A298462, A298463, A298464, A298466.
%K A298465 nonn
%O A298465 1,2
%A A298465 _Colin Barker_, Jan 19 2018