login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A132470 Smallest number at distance exactly 3n from nearest prime. 3
2, 26, 119, 532, 1339, 1342, 9569, 15704, 19633, 31424, 31427, 31430, 31433, 155960, 155963, 360698, 360701, 370312, 370315, 492170, 1357261, 1357264, 1357267, 2010802, 2010805, 4652428, 17051785, 17051788, 17051791, 17051794, 17051797, 20831416, 20831419, 20831422 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

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

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

LINKS

Andrew Howroyd, Table of n, a(n) for n = 0..258

FORMULA

a(n) = min {m : A051699(m) = 3n}. - R. J. Mathar, Nov 18 2007

EXAMPLE

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.

MAPLE

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

MATHEMATICA

terms = 34;

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

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

k = 1; a[0] = 2;

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

a /@ Range[0, terms-1] (* Jean-Fran├žois Alcover, Apr 09 2020, after Andrew Howroyd *)

PROG

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

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)}

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}

{R(aA002386(10^7))} \\ Andrew Howroyd, Jan 04 2020

CROSSREFS

Cf. A002386, A005250, A051699, A051728.

Sequence in context: A280212 A120551 A120547 * A153913 A246586 A067851

Adjacent sequences:  A132467 A132468 A132469 * A132471 A132472 A132473

KEYWORD

nonn

AUTHOR

Jonathan Vos Post, Sep 03 2007

EXTENSIONS

Corrected by Dean Hickerson, Sep 05 2007

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.

Corrected and extended by R. J. Mathar, Nov 18 2007

Terms a(19) and beyond from Andrew Howroyd, Jan 04 2020

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 26 05:07 EDT 2021. Contains 347664 sequences. (Running on oeis4.)