cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A231426 #27 Aug 15 2021 09:36:41
%S A231426 53,11,97,17,71,43,13,2,19,103,409,1457011,2744903797,5232781111
%N A231426 Least prime such that at most n digits may be appended to the right, preserving primality at each step.
%F A231426 a(n) is the least prime p=prime(k) such that A232128(p) (= A232127(k)) = n.
%F A231426 If a(n) = p, then a(n) = floor(A232129(p)/10^A232128(p)).
%F A231426 A232125(n) <= (a(n)+1)*10^n - 1. - _Michael S. Branicky_, Aug 15 2021
%e A231426 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 A231426 (Python)
%o A231426 from sympy import isprime, nextprime
%o A231426 def a(n):
%o A231426     p = 2
%o A231426     while True:
%o A231426         extends, reach = -1, {p}
%o A231426         while len(reach) > 0:
%o A231426             candidates = (int(str(e)+d) for d in "1379" for e in reach)
%o A231426             reach1 = set(filter(isprime, candidates))
%o A231426             extends, reach = extends + 1, reach1
%o A231426         if extends == n: return p
%o A231426         p = nextprime(p)
%o A231426 for n in range(12): print(a(n), end=", ") # _Michael S. Branicky_, Aug 15 2021
%Y A231426 Cf. A232128, A232127, A232126, A232125.
%K A231426 nonn,base,more
%O A231426 0,1
%A A231426 _Michel Marcus_ and _M. F. Hasler_, Nov 19 2013
%E A231426 a(12)-a(13) from _Michael S. Branicky_, Aug 15 2021