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.

A051700 Distance from n to closest prime that is different from n.

Original entry on oeis.org

2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 2, 3, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 4, 1, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 2, 3, 2, 1, 6, 1, 2, 3, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 4, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 4, 1, 2, 1, 4, 1, 2, 3, 2, 1, 6, 1, 2, 3, 4, 3, 2, 1, 4, 1, 2, 1, 2, 1, 2, 1
Offset: 0

Views

Author

Keywords

Examples

			Closest primes to 0,1,2,3,4 are 2,2,3,2,3.
		

Crossrefs

Programs

  • Maple
    with(numtheory); f := n->min(nextprime(n)-n, n-prevprime(n));
  • Mathematica
    Table[Min[NextPrime[n]-n,n-NextPrime[n,-1]],{n,0,200}]  (* Harvey P. Dale, Mar 27 2011 *)

Extensions

More terms from James Sellers