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!)
A308438 a(n) is the smallest prime p whose decimal expansion begins with n and is such that the next prime is p+2n, or -1 if no such prime exists. 1
11, 223, 31, 401, 547, 619, 773, 8581, 9109, 10223, 1129, 12073, 130553, 14563, 150011, 161471, 17257, 18803, 191189, 20809, 210557, 225383, 237091, 240209, 2509433, 2613397, 277429, 283211, 2901649, 308153, 313409, 3204139, 3300613, 3419063, 3507739, 360091, 3727313, 3806347, 3930061, 4045421, 41018911 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Chai Wah Wu, Table of n, a(n) for n = 1..100

EXAMPLE

For n = 5, 547 is a prime starting with 5, and the next prime after 547 is 557 = 547 + 2*5.  Since this is the least number with these properties, a(5) = 547.

MAPLE

f:= proc(n) local d, p, q;

  for d from 0 do

    p:= nextprime(n*10^d-1);

    do

      q:= nextprime(p);

      if q - p = 2*n then return p fi;

      if q >= (n+1)*10^d then break fi;

      p:= q;

    od;

  od;

end proc:

map(f, [$1..50]);

PROG

(Python)

from sympy import nextprime

def A308438(n):

    l, p = 1, nextprime(n)

    while True:

        q = nextprime(p)

        if q-p == 2*n:

            return p

        p = q

        if p >= (n+1)*l:

            l *= 10

            p = nextprime(n*l) # Chai Wah Wu, May 31 2019

CROSSREFS

Cf. A018800, A030665.

Sequence in context: A048377 A192686 A323416 * A103611 A142541 A295542

Adjacent sequences:  A308435 A308436 A308437 * A308439 A308440 A308441

KEYWORD

nonn,base,look

AUTHOR

J. M. Bergot and Robert Israel, May 30 2019

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 January 20 14:17 EST 2021. Contains 340302 sequences. (Running on oeis4.)