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!)
A030665 Smallest nontrivial extension of n which is prime. 9
11, 23, 31, 41, 53, 61, 71, 83, 97, 101, 113, 127, 131, 149, 151, 163, 173, 181, 191, 2003, 211, 223, 233, 241, 251, 263, 271, 281, 293, 307, 311, 3203, 331, 347, 353, 367, 373, 383, 397, 401, 419, 421, 431, 443, 457, 461, 479, 487, 491, 503, 5101 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Chai Wah Wu, Table of n, a(n) for n = 1..10000 [T. D. Noe computed the first 1000 terms]

Chai Wah Wu, On a conjecture regarding primality of numbers constructed from prepending and appending identical digits, arXiv:1503.08883 [math.NT], 2015.

EXAMPLE

For n = 1, we could append 1, 3, 7, 9, 01, etc., to make a prime, but 1 gives the smallest of these, 11, so a(1) = 11.

For n = 2, although 2 is already prime, the definition requires an appending at least one digit. 1 doesn't work because 21 = 3 * 7, but 3 does because 23 is prime. Hence a(2) = 23.

MAPLE

f:= proc(n) local x0, d, r, y;

   for d from 1 do

     x0:= n*10^d;

     for r from 1 to 10^d-1 by 2 do

       if isprime(x0+r) then

          return(x0+r)

       fi

     od

   od

end proc:

seq(f(n), n=1..100); # Robert Israel, Dec 23 2014

MATHEMATICA

A030665[n_] := Module[{d = 10, nd = 10 * n}, While[True, x = NextPrime[nd]; If[x < nd + d, Return[x]]; d *= 10; nd *= 10]]; Array[A030665, 100] (* Jean-Fran├žois Alcover, Oct 19 2016, translated from Chai Wah Wu's Python code *)

PROG

(Python)

from sympy import nextprime

def A030665(n):

    d, nd = 10, 10*n

    while True:

        x = nextprime(nd)

        if x < nd+d:

            return int(x)

        d *= 10

        nd *= 10 # Chai Wah Wu, May 24 2016

CROSSREFS

Cf. A018800, A077501.

Sequence in context: A038904 A179630 A060399 * A077501 A030675 A110786

Adjacent sequences:  A030662 A030663 A030664 * A030666 A030667 A030668

KEYWORD

nonn,base,nice

AUTHOR

Patrick De Geest

EXTENSIONS

Corrected by Ray Chandler, Aug 11 2003

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 April 5 06:13 EDT 2020. Contains 333238 sequences. (Running on oeis4.)