OFFSET
1,1
COMMENTS
The n-th pentagonal number is (3*n^2 - n)/2 = n*(3*n - 1)/2.
LINKS
K. D. Bajpai, Table of n, a(n) for n = 1..5535
EXAMPLE
376 is in the sequence because 376 = 16*(3*16 - 1)/2 = (373 + 379)/2, the arithmetic mean of two consecutive primes.
532 is in the sequence because 532 = 19*(3*19 - 1)/2 = (523 + 541)/2, the arithmetic mean of two consecutive primes.
MAPLE
KD := proc() local a, b, d, g; a:= n*(3*n-1)/2; b:=prevprime(a); d:=nextprime(b); g:=(b+d)/2; if a=g then RETURN (a); fi; end: seq(KD(), n = 2..500);
MATHEMATICA
Select[PolygonalNumber[5, Range[300]], !PrimeQ[#]&&#==(NextPrime[ #]+ NextPrime[ #, -1])/2&] (* Harvey P. Dale, Dec 26 2022 *)
PROG
(PARI) lista(nn) = for (n=1, nn, pn = n*(3*n-1)/2; if (pn > 2, precp = precprime(pn-1); if (pn == (precp + nextprime(precp+1))/2, print1(pn, ", ")))) \\ Michel Marcus, Dec 30 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
K. D. Bajpai, Dec 27 2013
EXTENSIONS
Erroneous term 5 removed by Michel Marcus, Dec 30 2013
STATUS
approved