|
|
A186995
|
|
Smallest weak prime in base n.
|
|
6
|
|
|
127, 2, 373, 83, 28151, 223, 6211, 2789, 294001, 3347, 20837899, 4751, 6588721, 484439, 862789, 10513, 2078920243, 10909, 169402249, 2823167, 267895961, 68543, 1016960933671, 181141, 121660507, 6139219, 11646280537, 488651
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
LINKS
|
|
|
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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|