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.

A323745 a(n) is the smallest prime that becomes composite if any single digit of its base-n expansion is changed to a different digit (but not to zero).

This page as a plain text file.
%I A323745 #22 Mar 25 2024 16:37:15
%S A323745 3,2,89,67,28151,223,6211,2789,294001,701,8399011,2423,691063,243367,
%T A323745 527099,10513,2078920243,10909,169402249,2114429,156760543,68543,
%U A323745 96733308587,181141,121660507,6139219,3141223681,114493
%N A323745 a(n) is the smallest prime that becomes composite if any single digit of its base-n expansion is changed to a different digit (but not to zero).
%C A323745 This sequence has several terms in common with A186995; if the restriction that no digit can be changed to zero were removed, A186995 would result.
%C A323745 a(30) > 10^10.
%C A323745 The next few terms after a(30) are 356479, 860343287, 399946711, ...
%F A323745 a(n) <= A186995(n). - _Chai Wah Wu_, Mar 25 2024
%e A323745 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.
%e A323745 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.
%e A323745 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.
%e A323745 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.
%o A323745 (Python)
%o A323745 from sympy import isprime, nextprime
%o A323745 from sympy.ntheory import digits
%o A323745 def A323745(n):
%o A323745     p = 2
%o A323745     while True:
%o A323745         m = 1
%o A323745         for j in digits(p,n)[:0:-1]:
%o A323745             for k in range(1,n):
%o A323745                 if k!=j and isprime(p+(k-j)*m):
%o A323745                     break
%o A323745             else:
%o A323745                 m *= n
%o A323745                 continue
%o A323745             break
%o A323745         else:
%o A323745             return p
%o A323745         p = nextprime(p) # _Chai Wah Wu_, Mar 25 2024
%Y A323745 Cf. A186995.
%K A323745 nonn,base,more
%O A323745 2,1
%A A323745 _Jon E. Schoenfield_, May 04 2019