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.

This page as a plain text file.
%I A113425 #12 Mar 13 2017 04:21:29
%S A113425 2,3,7,17,23,37,47,61,79,101,127,139,167,197,223,257,293,317,359,401,
%T A113425 439,487,523,577,619,677,727,787,839,907,967,1021,1087,1153,1223,1297,
%U A113425 1367,1447,1523,1601,1669,1759,1847,1933,2027,2113,2207,2309,2399,2503
%N A113425 Smallest prime closest to n^2.
%C A113425 A060272(n) = abs(A000290(n) - a(n));
%C A113425 a(n) <= A113426(n).
%H A113425 Robert Israel, <a href="/A113425/b113425.txt">Table of n, a(n) for n = 1..10000</a>
%p A113425 f:= proc(n) local k,d;
%p A113425   for k from 1 do
%p A113425     for d in [-1,1] do
%p A113425       if isprime(n^2 + k*d) then return n^2 + k*d fi
%p A113425   od od
%p A113425 end proc:
%p A113425 map(f, [$1..100]); # _Robert Israel_, Mar 10 2017
%t A113425 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 *)
%K A113425 nonn
%O A113425 1,1
%A A113425 _Reinhard Zumkeller_, Oct 31 2005