|
|
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
k = prevprime(m//2)
if k + nextprime(k) == m:
n += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|