login
The least k such that exactly n binary near-repunit primes can be formed from 2^k-1 by changing one digit from 1 to 0.
1

%I #34 Nov 11 2023 00:15:41

%S 1,3,4,6,8,12,38,24,18,36,48,20,248,588,144,252,5520,168,7200,2400,

%T 2850

%N The least k such that exactly n binary near-repunit primes can be formed from 2^k-1 by changing one digit from 1 to 0.

%C Similar to A065083 but using binary repdigits instead of base 10.

%C Note that as in A065083, the most significant digit/bit is not replaced with a zero in determining a prime.

%C a(21) > 7800.

%C a(25) = 11520 and a(n) > 12000 for n in 21..24 and n > 25 using A272143. - _Michael S. Branicky_, Nov 09 2023

%e a(3)=6 because 2^6 - 1 = 111111_2 and

%e 1) 111101_2 = 61,

%e 2) 111011_2 = 59,

%e 3) 101111_2 = 47,

%e and no other k < 6 yields exactly three primes.

%o (PARI) a(n) = my(k=1); while(sum(i=1, k-2, ispseudoprime(2^k-1-2^i)) != n, k++); k \\ _Thomas Scheuerle_, Nov 07 2023

%o (Python)

%o from itertools import count

%o from sympy import isprime

%o def A367081(n):

%o for k in count(1):

%o a, c = (1<<k)-1, 0

%o for i in range(k-2,0,-1):

%o if isprime(a^(1<<i)):

%o c += 1

%o if c >= n+1:

%o break

%o if c == n:

%o return k # _Chai Wah Wu_, Nov 11 2023

%Y Cf. A002275, A034093, A065074, A065083, A272143.

%K nonn,base,more

%O 0,2

%A _Robert Price_, Nov 06 2023