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!)
A132470 Smallest number at distance exactly 3n from nearest prime. 3

%I #24 Apr 09 2020 09:56:50

%S 2,26,119,532,1339,1342,9569,15704,19633,31424,31427,31430,31433,

%T 155960,155963,360698,360701,370312,370315,492170,1357261,1357264,

%U 1357267,2010802,2010805,4652428,17051785,17051788,17051791,17051794,17051797,20831416,20831419,20831422

%N Smallest number at distance exactly 3n from nearest prime.

%C Let f(m)= A051699(m) = exact distance from m to its closest prime (including m itself). Then a(n) = min { m : f(m) = 3n}. - _R. J. Mathar_, Nov 18 2007

%C This sequence can be derived from the record prime gap sequences A002386 and A005250. In particular, for n > 0, a(n) = A002386(k) + 3*n where k is the least index such that A005250(k) >= 3*n. - _Andrew Howroyd_, Jan 04 2020

%H Andrew Howroyd, <a href="/A132470/b132470.txt">Table of n, a(n) for n = 0..258</a>

%F a(n) = min {m : A051699(m) = 3n}. - _R. J. Mathar_, Nov 18 2007

%e a(3)=532 where 532+3*3 is prime and all numbers below 532 have a distance smaller or larger than 3n=9 to their nearest primes and there is no prime within a distance of 8 to 532.

%p A051699 := proc(m) if isprime(m) then 0 ; elif m <= 2 then op(m+1,[2,1]) ; else min(nextprime(m)-m,m-prevprime(m)) ; fi ; end: A132470 := proc(n) local m ; if n = 0 then RETURN(2); else for m from 0 do if A051699(m) = 3 * n then RETURN(m) ; fi ; od: fi ; end: seq(A132470(n),n=0..18) ; # _R. J. Mathar_, Nov 18 2007

%t terms = 34;

%t gaps = Cases[Import["https://oeis.org/A002386/b002386.txt", "Table"], {_, _}][[;; terms, 2]];

%t w[n_] := (NextPrime[gaps[[n]] + 1] - gaps[[n]])/6 // Floor;

%t k = 1; a[0] = 2;

%t For[n = 1, n <= terms, n++, While[w[k] < n, k++]; a[n] = gaps[[k]] + 3n];

%t a /@ Range[0, terms-1] (* _Jean-François Alcover_, Apr 09 2020, after _Andrew Howroyd_ *)

%o (PARI) \\ here R(gaps) wants prefix of A002386 as vector.

%o aA002386(lim)={my(L=List(),q=2,g=0); forprime(p=3, lim, if(p-q>g, listput(L,q); g=p-q); q=p); Vec(L)}

%o R(gaps)={my(w=vector(#gaps, n, nextprime(gaps[n]+1) - gaps[n])\6, r=vector(w[#w]+1), k=1); r[1]=2; for(n=1, w[#w], while(w[k]<n,k++); r[n+1]=gaps[k] + 3*n); r}

%o {R(aA002386(10^7))} \\ _Andrew Howroyd_, Jan 04 2020

%Y Cf. A002386, A005250, A051699, A051728.

%K nonn

%O 0,1

%A _Jonathan Vos Post_, Sep 03 2007

%E Corrected by _Dean Hickerson_, Sep 05 2007

%E Both this sequence and A051728 should be checked. There are two possibilities for confusion in each case. In defining f(m), does one allow or exclude m itself, in case m is a prime? In defining a(n), does one require (here) that f(m) = 3n or only that >= 3n, or (in A051728) that f(m) = 2n or only >= 2n? Probably there should be several sequences, to include all the possibilities in each case. - _N. J. A. Sloane_, Nov 18 2007. Added Nov 20 2007: _R. J. Mathar_ has now clarified the definition of the present sequence.

%E Corrected and extended by _R. J. Mathar_, Nov 18 2007

%E Terms a(19) and beyond from _Andrew Howroyd_, Jan 04 2020

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 March 28 12:26 EDT 2024. Contains 371254 sequences. (Running on oeis4.)