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-5 of 5 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

A372516 Number of ones minus number of zeros in the binary expansion of the n-th prime number.

Original entry on oeis.org

0, 2, 1, 3, 2, 2, -1, 1, 3, 3, 5, 0, 0, 2, 4, 2, 4, 4, -1, 1, -1, 3, 1, 1, -1, 1, 3, 3, 3, 1, 7, -2, -2, 0, 0, 2, 2, 0, 2, 2, 2, 2, 6, -2, 0, 2, 2, 6, 2, 2, 2, 6, 2, 6, -5, -1, -1, 1, -1, -1, 1, -1, 1, 3, 1, 3, 1, -1, 3, 3, -1, 3, 5, 3, 5, 7, -1, 1, -1, 1, 1
Offset: 1

Views

Author

Gus Wiseman, May 13 2024

Keywords

Comments

Absolute value is A177718.

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1), and 83 is the 23rd prime, so a(23) = 4 - 3 = 1.
		

Crossrefs

The sum instead of difference is A035100, firsts A372684 (primes A104080).
The negative version is A037861(A000040(n)).
Restriction of A145037 to the primes.
The unsigned version is A177718.
- Positions of zeros are A177796, indices of the primes A066196.
- Positions of positive terms are indices of the primes A095070.
- Positions of negative terms are indices of the primes A095071.
- Positions of negative ones are A372539, indices of the primes A095072.
- Positions of ones are A372538, indices of the primes A095073.
- Positions of nonnegative terms are indices of the primes A095074.
- Positions of nonpositive terms are indices of the primes A095075.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives length of binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists the binary indices of each prime.

Programs

  • Mathematica
    Table[DigitCount[Prime[n],2,1]-DigitCount[Prime[n],2,0],{n,100}]
    DigitCount[#,2,1]-DigitCount[#,2,0]&/@Prime[Range[100]] (* Harvey P. Dale, May 09 2025 *)

Formula

a(n) = A000120(A000040(n)) - A080791(A000040(n)).
a(n) = A014499(n) - A035103(n).
a(n) = A145037(A000040(n))

A372538 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is 1.

Original entry on oeis.org

3, 8, 20, 23, 24, 26, 30, 58, 61, 63, 65, 67, 78, 80, 81, 82, 84, 88, 185, 187, 194, 200, 201, 203, 213, 214, 215, 221, 225, 226, 227, 234, 237, 246, 249, 253, 255, 256, 257, 259, 266, 270, 280, 284, 287, 290, 573, 578, 586, 588, 591, 593, 611, 614, 615, 626
Offset: 1

Views

Author

Gus Wiseman, May 13 2024

Keywords

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1) with ones minus zeros 4 - 3 = 1, and 83 is the 23rd prime, so 23 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
     5:           101 ~ {1,3}
    19:         10011 ~ {1,2,5}
    71:       1000111 ~ {1,2,3,7}
    83:       1010011 ~ {1,2,5,7}
    89:       1011001 ~ {1,4,5,7}
   101:       1100101 ~ {1,3,6,7}
   113:       1110001 ~ {1,5,6,7}
   271:     100001111 ~ {1,2,3,4,9}
   283:     100011011 ~ {1,2,4,5,9}
   307:     100110011 ~ {1,2,5,6,9}
   313:     100111001 ~ {1,4,5,6,9}
   331:     101001011 ~ {1,2,4,7,9}
   397:     110001101 ~ {1,3,4,8,9}
   409:     110011001 ~ {1,4,5,8,9}
   419:     110100011 ~ {1,2,6,8,9}
   421:     110100101 ~ {1,3,6,8,9}
   433:     110110001 ~ {1,5,6,8,9}
   457:     111001001 ~ {1,4,7,8,9}
  1103:   10001001111 ~ {1,2,3,4,7,11}
  1117:   10001011101 ~ {1,3,4,5,7,11}
  1181:   10010011101 ~ {1,3,4,5,8,11}
  1223:   10011000111 ~ {1,2,3,7,8,11}
		

Crossrefs

Restriction of A031448 to the primes, positions of ones in A145037.
Taking primes gives A095073, negative A095072.
Positions of ones in A372516, absolute value A177718.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==1&]

A372539 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is -1.

Original entry on oeis.org

7, 19, 21, 25, 56, 57, 59, 60, 62, 68, 71, 77, 79, 87, 175, 177, 179, 180, 186, 188, 189, 192, 193, 195, 196, 197, 204, 210, 212, 216, 218, 243, 244, 248, 254, 262, 263, 265, 279, 567, 572, 576, 577, 583, 592, 598, 599, 600, 602, 603, 605, 606, 610, 613, 616
Offset: 1

Views

Author

Gus Wiseman, May 14 2024

Keywords

Examples

			The binary expansion of 17 is (1,0,0,0,1) with ones minus zeros 2 - 3 = -1, and 17 is the 7th prime, 7 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
    17:         10001 ~ {1,5}
    67:       1000011 ~ {1,2,7}
    73:       1001001 ~ {1,4,7}
    97:       1100001 ~ {1,6,7}
   263:     100000111 ~ {1,2,3,9}
   269:     100001101 ~ {1,3,4,9}
   277:     100010101 ~ {1,3,5,9}
   281:     100011001 ~ {1,4,5,9}
   293:     100100101 ~ {1,3,6,9}
   337:     101010001 ~ {1,5,7,9}
   353:     101100001 ~ {1,6,7,9}
   389:     110000101 ~ {1,3,8,9}
   401:     110010001 ~ {1,5,8,9}
   449:     111000001 ~ {1,7,8,9}
  1039:   10000001111 ~ {1,2,3,4,11}
  1051:   10000011011 ~ {1,2,4,5,11}
  1063:   10000100111 ~ {1,2,3,6,11}
  1069:   10000101101 ~ {1,3,4,6,11}
  1109:   10001010101 ~ {1,3,5,7,11}
  1123:   10001100011 ~ {1,2,6,7,11}
  1129:   10001101001 ~ {1,4,6,7,11}
  1163:   10010001011 ~ {1,2,4,8,11}
		

Crossrefs

Restriction of A031444 (positions of '-1's in A145037) to A000040.
Taking primes gives A095072.
Positions of negative ones in A372516, absolute value A177718.
The negative version is A372538, taking primes A095073.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==-1&]

A372685 Prime numbers such that no lesser prime has the same binary weight (number of ones in binary expansion).

Original entry on oeis.org

2, 3, 7, 23, 31, 127, 311, 383, 991, 2039, 3583, 6143, 8191, 63487, 73727, 129023, 131071, 522239, 524287, 1966079, 4128767, 14680063, 16250879, 33546239, 67108351, 201064447, 260046847, 536739839, 1073479679, 2147483647, 5335154687, 8581545983, 16911433727
Offset: 1

Views

Author

Gus Wiseman, May 10 2024

Keywords

Comments

The unsorted version is A061712.

Examples

			The terms 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}
   127:       1111111 ~ {1,2,3,4,5,6,7}
   311:     100110111 ~ {1,2,3,5,6,9}
   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}
		

Crossrefs

This statistic (binary weight of primes) is A014499.
Sorted version of A061712.
For binary length instead of weight we have A104080, firsts of A035100.
These primes have indices A372686, sorted version of A372517.
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 primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    First/@GatherBy[Select[Range[1000],PrimeQ],DigitCount[#,2,1]&]
  • Python
    from itertools import islice
    from sympy import nextprime
    def A372685_gen(): # generator of terms
        p, a = 1, {}
        while (p:=nextprime(p)):
            if (c:=p.bit_count()) not in a:
                yield p
            a[c] = p
    A372685_list = list(islice(A372685_gen(),20)) # Chai Wah Wu, May 12 2024

Formula

a(n) = prime(A372686(n)).

Extensions

a(22)-a(33) from Chai Wah Wu, May 12 2024
Showing 1-5 of 5 results.