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.

This page as a plain text file.
%I A079666 #16 Jan 03 2017 12:04:47
%S A079666 1,3,8,17,12,11,18,51,200,59,238,41,276,165,104,281,214,397,348,159,
%T A079666 650,305,778,923,2242,1155,1090,911,822,1871,1280,1099,1516,3253,2578,
%U A079666 5849,3538,693,4010,1937,1284,5095,3212,2011,6268,6331,2160,1943,12470,13443,12836,7405,25428,7115,22596,10873
%N A079666 Least k such that the distance from k^2 to closest prime = n or zero if no k exists.
%C A079666 From _Robert Israel_, Jan 03 2017: (Start)
%C A079666 For n > 1, a(n) == n (mod 2) unless it is 0.
%C A079666 a(191) > 3*10^7 if it is not 0. (End)
%H A079666 Robert Israel, <a href="/A079666/b079666.txt">Table of n, a(n) for n = 1..190</a>
%p A079666 N:= 100: # for a(1)..a(N)
%p A079666 R[1]:= 1: count:= 1:
%p A079666 for k from 3 while count < N do
%p A079666 d:= min(nextprime(k^2)-k^2,k^2-prevprime(k^2));
%p A079666 if d <= N and not assigned(R[d]) then R[d]:= k; count:= count+1 fi
%p A079666 od:
%p A079666 seq(R[i],i=1..N); # _Robert Israel_, Jan 03 2017
%o A079666 (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)
%Y A079666 Cf. A051699, A060272.
%K A079666 nonn
%O A079666 1,2
%A A079666 _Benoit Cloitre_, Jan 26 2003
%E A079666 More terms from _Robert Israel_, Jan 03 2017