login
A367081
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
1, 3, 4, 6, 8, 12, 38, 24, 18, 36, 48, 20, 248, 588, 144, 252, 5520, 168, 7200, 2400, 2850
OFFSET
0,2
COMMENTS
Similar to A065083 but using binary repdigits instead of base 10.
Note that as in A065083, the most significant digit/bit is not replaced with a zero in determining a prime.
a(21) > 7800.
a(25) = 11520 and a(n) > 12000 for n in 21..24 and n > 25 using A272143. - Michael S. Branicky, Nov 09 2023
EXAMPLE
a(3)=6 because 2^6 - 1 = 111111_2 and
1) 111101_2 = 61,
2) 111011_2 = 59,
3) 101111_2 = 47,
and no other k < 6 yields exactly three primes.
PROG
(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
(Python)
from itertools import count
from sympy import isprime
def A367081(n):
for k in count(1):
a, c = (1<<k)-1, 0
for i in range(k-2, 0, -1):
if isprime(a^(1<<i)):
c += 1
if c >= n+1:
break
if c == n:
return k # Chai Wah Wu, Nov 11 2023
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Robert Price, Nov 06 2023
STATUS
approved