OFFSET
0,1
FORMULA
EXAMPLE
The prime numbers A000040(a(n)) together with their binary expansions and binary indices begin:
3: 11 ~ {1,2}
2: 10 ~ {2}
19: 10011 ~ {1,2,5}
17: 10001 ~ {1,5}
67: 1000011 ~ {1,2,7}
131: 10000011 ~ {1,2,8}
523: 1000001011 ~ {1,2,4,10}
257: 100000001 ~ {1,9}
1033: 10000001001 ~ {1,4,11}
2053: 100000000101 ~ {1,3,12}
4099: 1000000000011 ~ {1,2,13}
8209: 10000000010001 ~ {1,5,14}
16417: 100000000100001 ~ {1,6,15}
32771: 1000000000000011 ~ {1,2,16}
65539: 10000000000000011 ~ {1,2,17}
65537: 10000000000000001 ~ {1,17}
262147: 1000000000000000011 ~ {1,2,19}
524353: 10000000000001000001 ~ {1,7,20}
1048609: 100000000000000100001 ~ {1,6,21}
2097169: 1000000000000000010001 ~ {1,5,22}
4194433: 10000000000000010000001 ~ {1,8,23}
8388617: 100000000000000000001001 ~ {1,4,24}
16777729: 1000000000000001000000001 ~ {1,10,25}
67108913: 100000000000000000000110001 ~ {1,5,6,27}
67239937: 100000000100000000000000001 ~ {1,18,27}
MATHEMATICA
nn=10000;
spnm[y_]:=Max@@NestWhile[Most, y, Union[#]!=Range[0, Max@@#]&];
dcs=DigitCount[Select[Range[nn], PrimeQ], 2, 0];
Table[Position[dcs, i][[1, 1]], {i, 0, spnm[dcs]}]
PROG
(Python)
from itertools import count
from sympy import isprime, primepi
from sympy.utilities.iterables import multiset_permutations
def A372474(n):
for l in count(n):
m = 1<<l
for d in multiset_permutations('0'*n+'1'*(l-n)):
k = m+int('0'+''.join(d), 2)
if isprime(k):
return primepi(k) # Chai Wah Wu, May 13 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gus Wiseman, May 11 2024
EXTENSIONS
a(22)-a(35) from and offset corrected by Chai Wah Wu, May 13 2024
STATUS
approved