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.

A113425 Smallest prime closest to n^2.

Original entry on oeis.org

2, 3, 7, 17, 23, 37, 47, 61, 79, 101, 127, 139, 167, 197, 223, 257, 293, 317, 359, 401, 439, 487, 523, 577, 619, 677, 727, 787, 839, 907, 967, 1021, 1087, 1153, 1223, 1297, 1367, 1447, 1523, 1601, 1669, 1759, 1847, 1933, 2027, 2113, 2207, 2309, 2399, 2503
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 31 2005

Keywords

Comments

A060272(n) = abs(A000290(n) - a(n));
a(n) <= A113426(n).

Programs

  • Maple
    f:= proc(n) local k,d;
      for k from 1 do
        for d in [-1,1] do
          if isprime(n^2 + k*d) then return n^2 + k*d fi
      od od
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 10 2017
  • Mathematica
    sp[n_]:=Module[{n2=n^2 ,npu,npd},npu=NextPrime[n2]; npd=NextPrime[n2,-1]; If[n2-npd<=npu-n2,npd,npu]]; sp/@Range[50]  (* Harvey P. Dale, Feb 05 2011 *)