login
A389926
The total length of the base n sequence when starting from 2 and creating the smallest unused prime number, when read in base n, by either removing or adding a single digit, from 0 to n-1, anywhere in the base n value of the previous number. If the base n sequence does not terminate, a(n) = -1.
5
43, 4, 30, 23, 29088, 36, 2771, 513, 205696, 659, 4016219, 425
OFFSET
2,1
COMMENTS
See A387852 for the final number in each sequence for base n.
It is conjectured that the sequence of primes in base n terminates for all n.
a(14) > 20000, a(15) = 9309, a(17) = 579, a(19) = 3527. - Michael S. Branicky, Oct 22 2025
EXAMPLE
a(2) = 43. See A389925 (removing the leading 1 term).
a(10) = 205696. See A389825.
a(3) = 4 as in base 3 the entire 4-term sequence is: 2 = 2_3, 5 = 12_3, 11 = 102_3, 3 = 10_3, and 3 = 10_3 is the final term as no primes can be created from removing a digit from 10_3, while the only prime that can be created from adding a 0, 1 or 2 digit is 11 = 102_3, but that has already been used.
PROG
(Python)
from gmpy2 import digits, is_prime, mpz
def a(n):
base = n
an, aset, digset = 2, {2}, "".join(digits(i, base) for i in range(base))
while an != -1:
aset.add(an)
s = digits(an, base)
D = set(p for i in range(len(s)) if len(t:=s[:i]+s[i+1:]) and is_prime(p:=mpz(t, base)))
if D and (Dcands:=D-aset):
an = min(D - aset)
continue
A = set(p for i in range(len(s)+1) for d in digset if is_prime(p:=mpz(s[:i]+d+s[i:], base)))
an = min(Acands) if A and (Acands:=A-aset) else -1
return len(aset)
print([a(n) for n in range(2, 10)]) # Michael S. Branicky, Oct 21 2025
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Scott R. Shannon, Oct 19 2025
STATUS
approved