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”).

A072680
Difference between (least prime >= n) and (largest prime <= n).
4
0, 0, 2, 0, 2, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4, 0, 6, 6, 6, 6, 6, 0, 2, 0, 6, 6, 6, 6, 6, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4, 0, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 0, 2, 0, 6, 6, 6, 6, 6, 0, 4, 4, 4, 0, 2, 0, 6, 6, 6, 6, 6, 0, 4, 4, 4, 0, 6, 6, 6, 6, 6, 0, 8, 8, 8, 8, 8, 8, 8, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4
OFFSET
2,3
COMMENTS
a(n) = 0 iff n is prime.
LINKS
FORMULA
a(n) = A007918(n) - A007917(n).
a(n) = A057427(n - A007917(n)) * A001223(A049084(A007917(n))).
MATHEMATICA
f[n_]:=If[PrimeQ[n], 0, NextPrime[n]-NextPrime[n, -1]]; Array[f, 110, 2] (* Harvey P. Dale, Sep 22 2011 *)
PROG
(MuPAD) numlib::prevprime(i)*(-1)-nextprime(i)*(-1)$ i = 2..106 // Zerinvary Lajos, Feb 26 2007
(PARI) A072680(n) = (nextprime(n) - precprime(n)); \\ Antti Karttunen, Sep 23 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jul 01 2002
STATUS
approved