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.

A079666 Least k such that the distance from k^2 to closest prime = n or zero if no k exists.

Original entry on oeis.org

1, 3, 8, 17, 12, 11, 18, 51, 200, 59, 238, 41, 276, 165, 104, 281, 214, 397, 348, 159, 650, 305, 778, 923, 2242, 1155, 1090, 911, 822, 1871, 1280, 1099, 1516, 3253, 2578, 5849, 3538, 693, 4010, 1937, 1284, 5095, 3212, 2011, 6268, 6331, 2160, 1943, 12470, 13443, 12836, 7405, 25428, 7115, 22596, 10873
Offset: 1

Views

Author

Benoit Cloitre, Jan 26 2003

Keywords

Comments

From Robert Israel, Jan 03 2017: (Start)
For n > 1, a(n) == n (mod 2) unless it is 0.
a(191) > 3*10^7 if it is not 0. (End)

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    R[1]:= 1: count:= 1:
    for k from 3 while count < N do
    d:= min(nextprime(k^2)-k^2,k^2-prevprime(k^2));
    if d <= N and not assigned(R[d]) then R[d]:= k; count:= count+1 fi
    od:
    seq(R[i],i=1..N); # Robert Israel, Jan 03 2017
  • PARI
    a(n)=if(n<0,0,s=1; while(abs(n-min(abs(precprime(s^2)-s^2),abs(nextprime(s^2)-s^2)))>0,s++); s)

Extensions

More terms from Robert Israel, Jan 03 2017