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!)
A231426 Least prime such that at most n digits may be appended to the right, preserving primality at each step. 1

%I #27 Aug 15 2021 09:36:41

%S 53,11,97,17,71,43,13,2,19,103,409,1457011,2744903797,5232781111

%N Least prime such that at most n digits may be appended to the right, preserving primality at each step.

%F a(n) is the least prime p=prime(k) such that A232128(p) (= A232127(k)) = n.

%F If a(n) = p, then a(n) = floor(A232129(p)/10^A232128(p)).

%F A232125(n) <= (a(n)+1)*10^n - 1. - _Michael S. Branicky_, Aug 15 2021

%e a(7) = 2 is the least prime which starts several sequences of 1+7 primes, e.g., (2, 23, 239, 2393, ..., 23399339) and others leading at most to 29399999 = A232129(2), where a digit is appended 7 times to yield a prime after each step, while it is not possible in any of the "branches" to append one more digit to the last term, preserving primality.

%o (Python)

%o from sympy import isprime, nextprime

%o def a(n):

%o p = 2

%o while True:

%o extends, reach = -1, {p}

%o while len(reach) > 0:

%o candidates = (int(str(e)+d) for d in "1379" for e in reach)

%o reach1 = set(filter(isprime, candidates))

%o extends, reach = extends + 1, reach1

%o if extends == n: return p

%o p = nextprime(p)

%o for n in range(12): print(a(n), end=", ") # _Michael S. Branicky_, Aug 15 2021

%Y Cf. A232128, A232127, A232126, A232125.

%K nonn,base,more

%O 0,1

%A _Michel Marcus_ and _M. F. Hasler_, Nov 19 2013

%E a(12)-a(13) from _Michael S. Branicky_, Aug 15 2021

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 11:59 EDT 2024. Contains 371254 sequences. (Running on oeis4.)