This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A372517 #20 May 13 2024 12:22:44 %S A372517 1,2,4,9,11,64,31,76,167,309,502,801,1028,7281,6363,12079,12251,43237, %T A372517 43390,146605,291640,1046198,951351,2063216,3957778,11134645,14198321, %U A372517 28186247,54387475,249939829,105097565,393248783,751545789,1391572698,2182112798,8242984130 %N A372517 Least k such that the k-th prime number has exactly n ones in its binary expansion. %C A372517 In other words, the a(n)-th prime is the least with binary weight n. The sorted version is A372686. %F A372517 A000040(a(n)) = A061712(n). %e A372517 The primes A000040(a(n)) together with their binary expansions and binary indices begin: %e A372517 2: 10 ~ {2} %e A372517 3: 11 ~ {1,2} %e A372517 7: 111 ~ {1,2,3} %e A372517 23: 10111 ~ {1,2,3,5} %e A372517 31: 11111 ~ {1,2,3,4,5} %e A372517 311: 100110111 ~ {1,2,3,5,6,9} %e A372517 127: 1111111 ~ {1,2,3,4,5,6,7} %e A372517 383: 101111111 ~ {1,2,3,4,5,6,7,9} %e A372517 991: 1111011111 ~ {1,2,3,4,5,7,8,9,10} %e A372517 2039: 11111110111 ~ {1,2,3,5,6,7,8,9,10,11} %e A372517 3583: 110111111111 ~ {1,2,3,4,5,6,7,8,9,11,12} %e A372517 6143: 1011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13} %e A372517 8191: 1111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13} %e A372517 73727: 10001111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,17} %e A372517 63487: 1111011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13,14,15,16} %t A372517 spsm[y_]:=Max@@NestWhile[Most,y,Union[#]!=Range[Max@@#]&]; %t A372517 j=DigitCount[#,2,1]&/@Select[Range[1000],PrimeQ]; %t A372517 Table[Position[j,k][[1,1]],{k,spsm[j]}] %o A372517 (PARI) a(n) = my(k=1, p=2); while(hammingweight(p) !=n, p = nextprime(p+1); k++); k; \\ _Michel Marcus_, May 13 2024 %o A372517 (Python) %o A372517 from itertools import count %o A372517 from sympy import isprime, primepi %o A372517 from sympy.utilities.iterables import multiset_permutations %o A372517 def A372517(n): %o A372517 for l in count(n-1): %o A372517 m = 1<<l %o A372517 for d in multiset_permutations('0'*(l-n+1)+'1'*(n-1)): %o A372517 k = m+int('0'+''.join(d),2) %o A372517 if isprime(k): %o A372517 return primepi(k) # _Chai Wah Wu_, May 13 2024 %Y A372517 Positions firsts of first appearances in A014499. %Y A372517 Taking primes gives A061712. %Y A372517 Counting zeros (weight) gives A372474, firsts of A035103. %Y A372517 For binary length we have A372684 (take primes A104080), firsts of A035100. %Y A372517 The sorted version is A372686, taking primes A372685. %Y A372517 A000120 counts ones in binary expansion (binary weight), zeros A080791. %Y A372517 A029837 gives greatest binary index, least A001511. %Y A372517 A030190 gives binary expansion, reversed A030308. %Y A372517 A048793 lists binary indices, reverse A272020, sum A029931. %Y A372517 A372471 lists binary indices of primes. %Y A372517 Cf. A000040, A066195, A069010, A070939, A071814, A211997, A372429, A372516. %K A372517 nonn,base %O A372517 1,2 %A A372517 _Gus Wiseman_, May 12 2024 %E A372517 a(32)-a(36) from _Pontus von Brömssen_, May 13 2024