login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A056140
a(n) = n^2 - previousprime(n)*nextprime(n), for n>2.
2
-1, 1, 4, 1, -6, -13, 4, 23, 30, 1, -18, -25, 4, 35, 42, 1, -30, -37, 4, 47, -22, -91, -42, 9, 62, 117, 128, 1, -112, -123, -58, 9, 78, 149, 98, -73, 4, 83, 90, 1, -78, -85, 4, 95, -70, -187, -90, 9, 110, 213, 36, -211, -102, 9, 122, 237, 248, 1, -232, -243
OFFSET
3,3
COMMENTS
a(n) is never 0.
FORMULA
a(n) = n^2-A007917(n-1)*A007918(n+1) = A000290(n)-A013638(n).
EXAMPLE
a(3)=3^2-2*5=-1, a(4)=4^2-3*5=1.
MATHEMATICA
Table[n^2-NextPrime[n]NextPrime[n, -1], {n, 3, 80}] (* Harvey P. Dale, Aug 22 2011 *)
PROG
(PARI) a(n) = n^2 - precprime(n-1)*nextprime(n+1); \\ Michel Marcus, Mar 22 2020
CROSSREFS
Sequence in context: A083843 A094264 A298829 * A225419 A140895 A343599
KEYWORD
easy,sign
AUTHOR
Henry Bottomley, Jun 15 2000
EXTENSIONS
More terms from Harvey P. Dale, Aug 22 2011
STATUS
approved