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.

A060268 Distance of 2n from the closest prime.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 7, 5, 3, 1, 1, 1, 1, 3, 1, 1, 1, 3, 5, 3, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 5, 3, 1, 1, 1, 1, 1, 1, 3, 5, 5, 3, 1, 1
Offset: 2

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			n=13, 2n=26 surrounded by 23 and 29 which are from 26 in equal distance of 3 and min{3,3}=3=a(13).
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(min(nextprime(2*i)-2*i, 2*i-prevprime(2*i)), i=2...256)];
  • Mathematica
    a[n_] := Min[NextPrime[2*n] - 2*n, 2*n - NextPrime[2*n, -1]]; Array[a, 100, 2] (* Amiram Eldar, Sep 16 2020 *)
  • PARI
    a(n) = min(2*n - precprime(2*n-1), nextprime(2*n+1) - 2*n); \\ Michel Marcus, Sep 16 2020

Formula

a(n) = min(A049653(n), A060266(n)). - Michel Marcus, Sep 16 2020