OFFSET
2,1
COMMENTS
In base b, a prime is said to be weakly prime if changing any digit produces only composite numbers. Tao proves that in any fixed base there are an infinite number of weakly primes.
In particular, changing the leading digit to 0 must produce a composite number. These are also called weak primes, weakly primes, and isolated primes. - N. J. A. Sloane, May 06 2019
a(24) > 10^11. - Jon E. Schoenfield, May 06 2019
a(30) > 2*10^12. - Giovanni Resta, Jun 17 2019
a(30) > 10^13. - Dana Jacobsen, Mar 25 2023
a(n) appears to be relatively smaller for n odd than for n even. For instance, a(31) = 356479, a(33) = 399946711, a(35) = 22549349, a(37) = 8371249. a(n) for n of the form 6k+3 appear to be relatively larger than a(n) for other odd n. a(n) for n of the form 6k appear to be relatively larger than a(n) for other even n. - Chai Wah Wu, Mar 24 2024
LINKS
Terence Tao, A remark on primality testing and decimal expansions, arXiv:0802.3361 [math.NT], 2008.
Terence Tao, A remark on primality testing and decimal expansions, Journal of the Australian Mathematical Society 91:3 (2011), pp. 405-413.
Eric Weisstein's World of Mathematics, Weakly Prime
MATHEMATICA
isWeak[n_, base_] := Module[{d, e, weak, num}, d = IntegerDigits[n, base]; weak = True; Do[e = d; e[[i]] = j; num = FromDigits[e, base]; If[num != n && PrimeQ[num], weak = False; Break[]], {i, Length[d]}, {j, 0, base - 1}]; weak]; Table[p = 2; While[! isWeak[p, n], p = NextPrime[p]]; p, {n, 2, 16}]
PROG
(Python)
from itertools import count
from sympy import isprime
from sympy.ntheory.digits import digits
def fromdigits(d, b):
n = 0
for di in d: n *= b; n += di
return n
def h1(n, b): # hamming distance 1 neighbors of n in base b
d = digits(n, b)[1:]; L = len(d)
yield from (fromdigits(d[:i]+[c]+d[i+1:], b) for c in range(b) for i in range(L) if c!=d[i])
def ok(n, b): return isprime(n) and all(not isprime(k) for k in h1(n, b))
def a(n): return next(k for k in count(2) if ok(k, n))
print([a(n) for n in range(2, 12)]) # Michael S. Branicky, Jul 31 2022
(Python)
from sympy import isprime, nextprime
from sympy.ntheory import digits
def A186995(n):
p = 2
while True:
s = digits(p, n)[1:]
l = len(s)
for i, j in enumerate(s[::-1]):
m = n**i
for k in range(n):
if k!=j and isprime(p+(k-j)*m):
break
else:
continue
break
else:
return p
p = nextprime(p) # Chai Wah Wu, Mar 24 2024
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
T. D. Noe, Mar 01 2011
EXTENSIONS
a(17)-a(23) from Terentyev Oleg, Sep 04 2011
a(24)-a(29) from Giovanni Resta, Jun 17 2019
STATUS
approved