OFFSET
2,1
COMMENTS
FORMULA
a(n) <= A186995(n). - Chai Wah Wu, Mar 25 2024
EXAMPLE
a(2)=3 because 3 is prime and its base-2 expansion is 11_2, which cannot have either of its digits changed to a nonzero digit, whereas the only smaller prime, i.e., 2 = 10_2, yields another prime if its 0 digit is changed to a 1.
a(3)=2 because 2 = 2_3 is prime and, in base 3, the only way to change its digit to another (nonzero) digit is to change it to 1_3 = 1, which is nonprime.
a(4)=89 because 89 = 1121_4 is prime, every number that can be obtained by changing one of its digits to another (nonzero) digit is nonprime (1122_4=90, 1123_4=91, 1111_4=85, 1131_4=93, 1221_4=105, 1321_4=121, 2121_4=153, 3121_4=217), and there is no prime smaller than 89 that has this property.
a(18)=2078920243 because 2078920243 = 3723de91_18 (where the letters d and e represent the base-18 digits whose values are 13 and 14, respectively), and each of the 128 other base-18 numbers that can be obtained by changing one of its eight digits to another (nonzero) digit is nonprime, and no smaller prime has this property.
PROG
(Python)
from sympy import isprime, nextprime
from sympy.ntheory import digits
def A323745(n):
p = 2
while True:
m = 1
for j in digits(p, n)[:0:-1]:
for k in range(1, n):
if k!=j and isprime(p+(k-j)*m):
break
else:
m *= n
continue
break
else:
return p
p = nextprime(p) # Chai Wah Wu, Mar 25 2024
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Jon E. Schoenfield, May 04 2019
STATUS
approved