login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A186995 Smallest weak prime in base n. 10

%I #49 Mar 24 2024 12:34:29

%S 127,2,373,83,28151,223,6211,2789,294001,3347,20837899,4751,6588721,

%T 484439,862789,10513,2078920243,10909,169402249,2823167,267895961,

%U 68543,1016960933671,181141,121660507,6139219,11646280537,488651

%N Smallest weak prime in base n.

%C 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.

%C 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

%C a(24) > 10^11. - _Jon E. Schoenfield_, May 06 2019

%C a(30) > 2*10^12. - _Giovanni Resta_, Jun 17 2019

%C a(30) > 10^13. - _Dana Jacobsen_, Mar 25 2023

%C 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

%H Terence Tao, <a href="https://arxiv.org/abs/0802.3361">A remark on primality testing and decimal expansions</a>, arXiv:0802.3361 [math.NT], 2008.

%H Terence Tao, <a href="https://doi.org/10.1017/S1446788712000043">A remark on primality testing and decimal expansions</a>, Journal of the Australian Mathematical Society 91:3 (2011), pp. 405-413.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WeaklyPrime.html">Weakly Prime</a>

%t 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}]

%o (Python)

%o from itertools import count

%o from sympy import isprime

%o from sympy.ntheory.digits import digits

%o def fromdigits(d, b):

%o n = 0

%o for di in d: n *= b; n += di

%o return n

%o def h1(n, b): # hamming distance 1 neighbors of n in base b

%o d = digits(n, b)[1:]; L = len(d)

%o yield from (fromdigits(d[:i]+[c]+d[i+1:], b) for c in range(b) for i in range(L) if c!=d[i])

%o def ok(n, b): return isprime(n) and all(not isprime(k) for k in h1(n, b))

%o def a(n): return next(k for k in count(2) if ok(k, n))

%o print([a(n) for n in range(2, 12)]) # _Michael S. Branicky_, Jul 31 2022

%o (Python)

%o from sympy import isprime, nextprime

%o from sympy.ntheory import digits

%o def A186995(n):

%o p = 2

%o while True:

%o s = digits(p,n)[1:]

%o l = len(s)

%o for i,j in enumerate(s[::-1]):

%o m = n**i

%o for k in range(n):

%o if k!=j and isprime(p+(k-j)*m):

%o break

%o else:

%o continue

%o break

%o else:

%o return p

%o p = nextprime(p) # _Chai Wah Wu_, Mar 24 2024

%Y Cf. A050249 (base 10), A137985 (base 2).

%K nonn,base,more

%O 2,1

%A _T. D. Noe_, Mar 01 2011

%E a(17)-a(23) from _Terentyev Oleg_, Sep 04 2011

%E a(24)-a(29) from _Giovanni Resta_, Jun 17 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)