login
Least k such that the k-th prime number has exactly n zeros in its binary expansion.
16

%I #20 May 13 2024 13:57:13

%S 2,1,8,7,19,32,99,55,174,310,565,1029,1902,3513,6544,6543,23001,43395,

%T 82029,155612,295957,564164,1077901,3957811,3965052,7605342,14630844,

%U 28194383,54400029,105097568,393615809,393615807,762939128,1480206930,2874398838,5586502349

%N Least k such that the k-th prime number has exactly n zeros in its binary expansion.

%F a(n) = A000720(A066195(n)). - _Robert Israel_, May 13 2024

%e The prime numbers A000040(a(n)) together with their binary expansions and binary indices begin:

%e 3: 11 ~ {1,2}

%e 2: 10 ~ {2}

%e 19: 10011 ~ {1,2,5}

%e 17: 10001 ~ {1,5}

%e 67: 1000011 ~ {1,2,7}

%e 131: 10000011 ~ {1,2,8}

%e 523: 1000001011 ~ {1,2,4,10}

%e 257: 100000001 ~ {1,9}

%e 1033: 10000001001 ~ {1,4,11}

%e 2053: 100000000101 ~ {1,3,12}

%e 4099: 1000000000011 ~ {1,2,13}

%e 8209: 10000000010001 ~ {1,5,14}

%e 16417: 100000000100001 ~ {1,6,15}

%e 32771: 1000000000000011 ~ {1,2,16}

%e 65539: 10000000000000011 ~ {1,2,17}

%e 65537: 10000000000000001 ~ {1,17}

%e 262147: 1000000000000000011 ~ {1,2,19}

%e 524353: 10000000000001000001 ~ {1,7,20}

%e 1048609: 100000000000000100001 ~ {1,6,21}

%e 2097169: 1000000000000000010001 ~ {1,5,22}

%e 4194433: 10000000000000010000001 ~ {1,8,23}

%e 8388617: 100000000000000000001001 ~ {1,4,24}

%e 16777729: 1000000000000001000000001 ~ {1,10,25}

%e 67108913: 100000000000000000000110001 ~ {1,5,6,27}

%e 67239937: 100000000100000000000000001 ~ {1,18,27}

%t nn=10000;

%t spnm[y_]:=Max@@NestWhile[Most,y,Union[#]!=Range[0,Max@@#]&];

%t dcs=DigitCount[Select[Range[nn],PrimeQ],2,0];

%t Table[Position[dcs,i][[1,1]],{i,0,spnm[dcs]}]

%o (Python)

%o from itertools import count

%o from sympy import isprime, primepi

%o from sympy.utilities.iterables import multiset_permutations

%o def A372474(n):

%o for l in count(n):

%o m = 1<<l

%o for d in multiset_permutations('0'*n+'1'*(l-n)):

%o k = m+int('0'+''.join(d),2)

%o if isprime(k):

%o return primepi(k) # _Chai Wah Wu_, May 13 2024

%Y Positions of first appearances in A035103.

%Y For squarefree instead of prime we have A372473, firsts of A372472.

%Y Counting ones (weight) gives A372517, firsts of A014499.

%Y Counting squarefree bits gives A372540, firsts of A372475, runs A077643.

%Y Counting squarefree ones gives A372541, firsts of A372433.

%Y Counting bits (length) gives A372684, firsts of A035100.

%Y A000120 counts ones in binary expansion (binary weight), zeros A080791.

%Y A030190 gives binary expansion, reversed A030308.

%Y A048793 lists positions of ones in reversed binary expansion, sum A029931.

%Y A070939 gives length of binary expansion (number of bits).

%Y Cf. A059015, A066195, A069010, A073642, A145037, A211997, A230877, A359359, A359400, A371571, A372516.

%K nonn,base

%O 0,1

%A _Gus Wiseman_, May 11 2024

%E a(22)-a(35) from and offset corrected by _Chai Wah Wu_, May 13 2024