cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

A372517 Least k such that the k-th prime number has exactly n ones in its binary expansion.

Original entry on oeis.org

1, 2, 4, 9, 11, 64, 31, 76, 167, 309, 502, 801, 1028, 7281, 6363, 12079, 12251, 43237, 43390, 146605, 291640, 1046198, 951351, 2063216, 3957778, 11134645, 14198321, 28186247, 54387475, 249939829, 105097565, 393248783, 751545789, 1391572698, 2182112798, 8242984130
Offset: 1

Views

Author

Gus Wiseman, May 12 2024

Keywords

Comments

In other words, the a(n)-th prime is the least with binary weight n. The sorted version is A372686.

Examples

			The primes A000040(a(n)) together with their binary expansions and binary indices begin:
        2:                     10 ~ {2}
        3:                     11 ~ {1,2}
        7:                    111 ~ {1,2,3}
       23:                  10111 ~ {1,2,3,5}
       31:                  11111 ~ {1,2,3,4,5}
      311:              100110111 ~ {1,2,3,5,6,9}
      127:                1111111 ~ {1,2,3,4,5,6,7}
      383:              101111111 ~ {1,2,3,4,5,6,7,9}
      991:             1111011111 ~ {1,2,3,4,5,7,8,9,10}
     2039:            11111110111 ~ {1,2,3,5,6,7,8,9,10,11}
     3583:           110111111111 ~ {1,2,3,4,5,6,7,8,9,11,12}
     6143:          1011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13}
     8191:          1111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13}
    73727:      10001111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,17}
    63487:       1111011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13,14,15,16}
		

Crossrefs

Positions firsts of first appearances in A014499.
Taking primes gives A061712.
Counting zeros (weight) gives A372474, firsts of A035103.
For binary length we have A372684 (take primes A104080), firsts of A035100.
The sorted version is A372686, taking primes A372685.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A029837 gives greatest binary index, least A001511.
A030190 gives binary expansion, reversed A030308.
A048793 lists binary indices, reverse A272020, sum A029931.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    spsm[y_]:=Max@@NestWhile[Most,y,Union[#]!=Range[Max@@#]&];
    j=DigitCount[#,2,1]&/@Select[Range[1000],PrimeQ];
    Table[Position[j,k][[1,1]],{k,spsm[j]}]
  • PARI
    a(n) = my(k=1, p=2); while(hammingweight(p) !=n, p = nextprime(p+1); k++); k; \\ Michel Marcus, May 13 2024
    
  • Python
    from itertools import count
    from sympy import isprime, primepi
    from sympy.utilities.iterables import multiset_permutations
    def A372517(n):
        for l in count(n-1):
            m = 1<Chai Wah Wu, May 13 2024

Formula

A000040(a(n)) = A061712(n).

Extensions

a(32)-a(36) from Pontus von Brömssen, May 13 2024

A372686 Sorted list of positions of first appearances in A014499 (number of ones in binary expansion of each prime).

Original entry on oeis.org

1, 2, 4, 9, 11, 31, 64, 76, 167, 309, 502, 801, 1028, 6363, 7281, 12079, 12251, 43237, 43390, 146605, 291640, 951351, 1046198, 2063216, 3957778, 11134645, 14198321, 28186247, 54387475, 105097565, 249939829, 393248783, 751545789, 1391572698, 2182112798, 8242984130
Offset: 1

Views

Author

Gus Wiseman, May 14 2024

Keywords

Comments

The unsorted version is A372517.

Examples

			The sequence contains 9 because the first 9 terms of A014499 are 1, 2, 2, 3, 3, 3, 2, 3, 4, and the last of these is the first position of 4.
		

Crossrefs

Positions of first appearances in A014499.
The unsorted version is A372517.
For binary length we have A372684, primes A104080, firsts of A035100.
Taking primes gives A372685, unsorted version A061712.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A029837 gives greatest binary index, least A001511.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of each prime, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives length of binary expansion (number of bits).
A372471 lists binary indices of primes.

Programs

  • Mathematica
    First/@GatherBy[Range[1000],DigitCount[Prime[#],2,1]&]

Formula

prime(a(n)) = A372685(n).

Extensions

a(26)-a(36) from Pontus von Brömssen, May 15 2024
Showing 1-2 of 2 results.