login
A372474
Least k such that the k-th prime number has exactly n zeros in its binary expansion.
16
2, 1, 8, 7, 19, 32, 99, 55, 174, 310, 565, 1029, 1902, 3513, 6544, 6543, 23001, 43395, 82029, 155612, 295957, 564164, 1077901, 3957811, 3965052, 7605342, 14630844, 28194383, 54400029, 105097568, 393615809, 393615807, 762939128, 1480206930, 2874398838, 5586502349
OFFSET
0,1
FORMULA
a(n) = A000720(A066195(n)). - Robert Israel, May 13 2024
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
Positions of first appearances in A035103.
For squarefree instead of prime we have A372473, firsts of A372472.
Counting ones (weight) gives A372517, firsts of A014499.
Counting squarefree bits gives A372540, firsts of A372475, runs A077643.
Counting squarefree ones gives A372541, firsts of A372433.
Counting bits (length) gives A372684, firsts of A035100.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A048793 lists positions of ones in reversed binary expansion, sum A029931.
A070939 gives length of binary expansion (number of bits).
Sequence in context: A105672 A338249 A214271 * A262007 A005489 A015152
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