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.

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

This page as a plain text file.
%I A079582 #19 Dec 19 2019 07:48:27
%S A079582 2,1,9,26,93,118,119,120,531,532,897,1140,1339,1340,1341,1342,1343,
%T A079582 1344,9569,15702,15703,15704,15705,19632,19633,19634,19635,31424,
%U A079582 31425,31426,31427,31428,31429,31430,31431,31432,31433,155958,155959,155960,155961
%N A079582 Least positive k such that the distance from k to closest prime = n.
%C A079582 This sequence only differs from A077019 for n = 2: a(2) = 9 whereas A077019(2) = 0. - _Rémy Sigrist_, Dec 19 2019
%t A079582 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 A079582 (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 A079582 Cf. A051699, A077019.
%K A079582 nonn
%O A079582 0,1
%A A079582 _Benoit Cloitre_, Jan 26 2003
%E A079582 More terms from _Robert G. Wilson v_, Jan 27 2003
%E A079582 Name clarified by _Rémy Sigrist_, Dec 19 2019