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.

A072680 Difference between (least prime >= n) and (largest prime <= n).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jul 01 2002

Keywords

Comments

a(n) = 0 iff n is prime.

Crossrefs

Programs

  • Mathematica
    f[n_]:=If[PrimeQ[n],0,NextPrime[n]-NextPrime[n,-1]];Array[f,110,2] (* Harvey P. Dale, Sep 22 2011 *)
  • 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

Formula

a(n) = A007918(n) - A007917(n).
a(n) = A057427(n - A007917(n)) * A001223(A049084(A007917(n))).