A371509 a(n) is the smallest prime that becomes composite if any single digit of its base-(2n+1) expansion is changed to a different digit (but not to zero).
2, 67, 223, 2789, 701, 2423, 243367, 10513, 10909, 2114429, 68543, 181141, 6139219, 114493, 356479, 399946711, 22549349, 8371249, 660040873, 12088631, 3352003
Offset: 1
Programs
-
Python
from sympy import isprime, nextprime from sympy.ntheory import digits def A371509(n): if n == 1: return 2 p, r = 5, (n<<1)+1 while True: m = 1 for j in digits(p,r)[:0:-1]: for k in range(2-(j&1),r,2): if k!=j and isprime(p+(k-j)*m): break else: m *= r continue break else: return p p = nextprime(p)
Comments