The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A079582 Least positive k such that the distance from k to closest prime = n. 0

%I #19 Dec 19 2019 07:48:27

%S 2,1,9,26,93,118,119,120,531,532,897,1140,1339,1340,1341,1342,1343,

%T 1344,9569,15702,15703,15704,15705,19632,19633,19634,19635,31424,

%U 31425,31426,31427,31428,31429,31430,31431,31432,31433,155958,155959,155960,155961

%N Least positive k such that the distance from k to closest prime = n.

%C This sequence only differs from A077019 for n = 2: a(2) = 9 whereas A077019(2) = 0. - _Rémy Sigrist_, Dec 19 2019

%t a[n_] := Block[{s = 1}, While[ PrimeQ[s] || Min[s - NextPrime[s, -1], NextPrime[s] - s] != n, s++ ]; s]; a[0] = 2; Table[a[n], {n, 0, 40}]

%o (PARI) a(n)=if(n<0,0,s=1; while(abs(n-min(abs(precprime(s)-s),abs(nextprime(s)-s)))>0,s++); s)

%Y Cf. A051699, A077019.

%K nonn

%O 0,1

%A _Benoit Cloitre_, Jan 26 2003

%E More terms from _Robert G. Wilson v_, Jan 27 2003

%E Name clarified by _Rémy Sigrist_, Dec 19 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 3 12:27 EDT 2024. Contains 373060 sequences. (Running on oeis4.)