login
Smallest weak prime in base 2n+1.
2

%I #29 Feb 16 2025 08:34:06

%S 2,83,223,2789,3347,4751,484439,10513,10909,2823167,68543,181141,

%T 6139219,488651,356479,399946711,22549349,8371249,660040873,12088631,

%U 3352003,234606268969,84343813,82751411,153722088497,141451831,11085190183,350552595007,535946951,658716229

%N Smallest weak prime in base 2n+1.

%C Bisection of A186995. Smallest weak prime in odd bases appear to be relatively smaller than smallest weak prime in even bases. This could be due to the fact that for an odd base and an odd prime, any digit change with an odd difference from the original digit results in an even number and thus not prime, so only digit changes with an even difference need to be checked for primality, whereas for an even base, all digit changes need to be checked.

%C Smallest weak prime in odd bases of the form 6k+3 appear to be relatively larger than smallest weak prime in other odd bases.

%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="https://mathworld.wolfram.com/WeaklyPrime.html">Weakly Prime</a>

%F a(n) = A186995(2*n+1).

%o (Python)

%o from sympy import isprime, nextprime

%o from sympy.ntheory import digits

%o def A371475(n):

%o if n == 1: return 2

%o p, r = 5, (n<<1)+1

%o while True:

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

%o l = len(s)

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

%o m = r**i

%o for k in range(j&1,r,2):

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

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

%K nonn,base,changed

%O 1,1

%A _Chai Wah Wu_, Mar 24 2024

%E a(22)-a(27) from _Michael S. Branicky_, Apr 01 2024

%E a(28)-a(30) from _Michael S. Branicky_, Apr 06 2024