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.

Previous Showing 21-30 of 31 results. Next

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

A072583 Numbers k with the property that there is no match when comparing the numbers of 0's and 1's in the binary representations of k and the k-th prime.

Original entry on oeis.org

2, 4, 9, 10, 11, 12, 14, 15, 17, 18, 27, 29, 33, 35, 36, 38, 39, 40, 43, 46, 48, 51, 52, 53, 54, 55, 56, 63, 66, 72, 73, 75, 76, 83, 85, 86, 90, 91, 92, 95, 96, 97, 100, 102, 104, 109, 111, 112, 113, 115, 117, 119, 120, 122, 123, 124, 126, 127, 129, 130, 131, 132, 133
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Comments

In other words, A000120(k) <> A000120(A000040(k)) and A000120(k) <> A023416(A000040(k)) and A023416(k) <> A000120(A000040(k)) and A023416(k) <> A023416(A000040(k)).
A000120(k) <> A014499(k) and A000120(k) <> A035103(k) and A023416(k) <> A014499(k) and A023416(k) <> A035103(k).

Examples

			k = 40 = '101000', A000040(40) = 173 = '10101101'.
		

Crossrefs

Programs

  • Mathematica
    With[{m = 150}, Select[Transpose[{Range[m], Prime[Range[m]]}], Intersection @@ DigitCount[#, 2] == {} &]][[;; , 1]] (* Amiram Eldar, Jul 28 2025 *)

Formula

a(n) = A049084(A072584(n)).

A168157 Number of 0's in the matrix whose lines are the binary expansion of the first n primes.

Original entry on oeis.org

1, 1, 4, 4, 9, 10, 19, 21, 22, 23, 23, 37, 40, 42, 43, 45, 46, 47, 69, 72, 76, 78, 81, 84, 88, 91, 93, 95, 97, 100, 100, 136, 141, 145, 149, 152, 155, 159, 162, 165, 168, 171, 172, 177, 181, 184, 187, 188, 191, 194, 197, 198, 201, 202, 263, 268, 273, 277, 282, 287
Offset: 1

Views

Author

M. F. Hasler, Nov 21 2009

Keywords

Comments

The matrix is to be taken of minimal size, i.e., have n lines and the number of columns needed to write the n-th prime in the last line, A035100(n). Otherwise said, there is no zero column except for n=1 (prime(1) = 2 = 10[2] in binary).
The number of zeros in the last line of the matrix is given by A035103(n).
One has a(n)=a(n-1) iff n = A059305(k) for some k, i.e. prime(n) is a Mersenne prime A000668(k) = A000225(A000043(k)).
If prime(n)=2^2^k+1 is a Fermat prime (A019434), n>2, then one has a(n)=a(n-1)+n-1+2^k-1.
More generally, the "big jumps" a(n+1) > a(n)+n happen whenever a column is added, i.e. when prime(n) = A014234(k) <=> prime(n+1) = A104080(k) for some k,n>1.

Examples

			a(4)=4 is the number of zeros in the matrix [010] /* = 2 in binary */ [011] /* = 3 in binary */ [101] /* = 5 in binary */ [111] /* = 7 in binary */
		

Programs

  • PARI
    A168157(n)=n*#binary(prime(n))-sum(i=1,n,norml2(binary(prime(i))))

Formula

a(n)=n*A035100(n)-A095375(n).

A327462 Number of holes in decimal expansion of n-th prime.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 2, 3, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 1, 2, 1, 1, 1, 2, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 1, 2, 0, 1, 1, 0, 1, 2, 3, 1, 2, 3, 2, 1, 1, 1, 2
Offset: 1

Views

Author

N. J. A. Sloane, Sep 27 2019

Keywords

Comments

This is A064692 restricted to the primes.

Crossrefs

Programs

  • PARI
    forprime (p=2, 439, print1 (vecsum(apply(d -> [1, 0, 0, 0, 1, 0, 1, 0, 2, 1][1+d], digits(p))) ", ")) \\ Rémy Sigrist, Sep 27 2019

A345867 Total number of 0's in the binary expansions of the first n primes.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 7, 9, 10, 11, 11, 14, 17, 19, 20, 22, 23, 24, 28, 31, 35, 37, 40, 43, 47, 50, 52, 54, 56, 59, 59, 64, 69, 73, 77, 80, 83, 87, 90, 93, 96, 99, 100, 105, 109, 112, 115, 116, 119, 122, 125, 126, 129, 130, 137, 142, 147, 151, 156, 161, 165, 170
Offset: 1

Views

Author

Alois P. Heinz, Jun 26 2021

Keywords

Examples

			a(3) = 2: 2 = 10_2, 3 = 11_2, 5 = 101_2, so there are two 0's in the binary expansions of the first three primes.
		

Crossrefs

Partial sums of A035103.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
          +add(1-i, i=Bits[Split](ithprime(n))))
        end:
    seq(a(n), n=1..100);
  • Mathematica
    Accumulate[DigitCount[Prime[Range[100]], 2, 0]] (* Paolo Xausa, Feb 26 2024 *)
  • Python
    from sympy import prime, primerange
    from itertools import accumulate
    def f(n): return (bin(n)[2:]).count('0')
    def aupton(nn): return list(accumulate(map(f, primerange(2, prime(nn)+1))))
    print(aupton(62)) # Michael S. Branicky, Jun 26 2021

Formula

a(n) = Sum_{i=1..n} A035103(i).
a(n) = a(n-1) for n in { A059305 }.
a(n) = A328659(n) - A095375(n).

A177959 n-th prime minus number of 0's in binary representation of n-th prime.

Original entry on oeis.org

1, 3, 4, 7, 10, 12, 14, 17, 22, 28, 31, 34, 38, 41, 46, 51, 58, 60, 63, 68, 69, 77, 80, 86, 93, 98, 101, 105, 107, 110, 127, 126, 132, 135, 145, 148, 154, 159, 164, 170, 176, 178, 190, 188, 193, 196, 208, 222, 224, 226, 230, 238, 238, 250, 250, 258, 264, 267, 272, 276
Offset: 1

Views

Author

Juri-Stepan Gerasimov, May 16 2010

Keywords

Crossrefs

Programs

  • Maple
    A023416 := proc(n) a := 0 ; for d in convert(n,base,2) do if d = 0 then a := a+1 ; end if; end do; a ; end proc:
    A035103 := proc(n) A023416(ithprime(n)) ; end proc:
    A177959 := proc(n) ithprime(n)-A035103(n) ; end proc:
    seq(A177959(n),n=1..120) ; # R. J. Mathar, May 30 2010

Formula

a(n) = A000040(n) - A035103(n).

Extensions

Corrected (39 removed, 124 replaced by 224, 126 replaced by 226) by R. J. Mathar, May 30 2010

A236695 The n-th prime with n 0-bits in its binary expansion.

Original entry on oeis.org

2, 43, 41, 139, 269, 773, 1049, 2309, 4357, 8737, 16673, 34819, 66569, 139393, 279553, 589829, 1051649, 2621569, 4260097, 9437189, 17039489, 33817601, 67649537, 167903233, 269484097, 545260033, 1074267137, 2155872769, 4311760897, 12884901893, 17184063521
Offset: 1

Views

Author

Irina Gerasimova, Jan 30 2014

Keywords

Examples

			Primes p(k) such that
A035103(p(k)) = 0: 3, 7, 31, 127, 8191,...
A035103(p(k)) = 1: 2, 5, 11, 13, 23, 29,...
A035103(p(k)) = 2: 19, 43, 53, 79, 103, 107,...
A035103(p(k)) = 3: 17, 37, 41, 71, 83, 89, 101,...
A035103(p(k)) = 4: 67, 73, 97, 139, 149, 163,...
A035103(p(k)) = 5: 131, 137, 193, 263, 269, 277,...
		

Crossrefs

Cf. A066195 (least prime having n zeros in binary), A236513 (the n-th prime with n 1-bits in its binary expansion).

Programs

  • PARI
    nz(n)=#binary(n)-hammingweight(n)
    a(n)=my(k=n);forprime(p=2,,if(nz(p)==n&&k--==0,return(p))) \\ Charles R Greathouse IV, Feb 04 2014

Extensions

New name from Ralf Stephan and Charles R Greathouse IV, Feb 04 2014
a(14)-a(27) from Charles R Greathouse IV, Feb 04 2014
a(28)-a(31) from Giovanni Resta, Feb 04 2014

A102566 a(n) = {minimal k such that f^k(prime(n)) = 1} where f(m) = (m+1)/2^r, 2^r is the highest power of two dividing m+1.

Original entry on oeis.org

2, 1, 2, 1, 2, 2, 4, 3, 2, 2, 1, 4, 4, 3, 2, 3, 2, 2, 5, 4, 5, 3, 4, 4, 5, 4, 3, 3, 3, 4, 1, 6, 6, 5, 5, 4, 4, 5, 4, 4, 4, 4, 2, 6, 5, 4, 4, 2, 4, 4, 4, 2, 4, 2, 8, 6, 6, 5, 6, 6, 5, 6, 5, 4, 5, 4, 5, 6, 4, 4, 6, 4, 3, 4, 3, 2, 6, 5, 6, 5, 5, 5, 3, 5, 3, 3, 6, 5, 4, 3, 4, 2, 3, 3, 3, 2, 2, 8, 7, 6, 7, 6, 6, 6, 5
Offset: 1

Views

Author

Yasutoshi Kohmoto, Feb 25 2005

Keywords

Comments

A066195(n+1) is the prime corresponding to the first n in this sequence. - David Wasserman, Apr 08 2008

Examples

			f(f(f(f(17)))) = 1, prime(7) = 17, so a(7) = 4.
prime(16) = 53 = (2*27-1) = (2*(2^2*7-1)-1) = (2*(2^2*(2^3*1-1)-1)-1), has 3 levels, so a(16) = 3.
		

Crossrefs

Programs

  • PARI
    f(n) = (n+1)/2^(valuation(n+1, 2));
    a(n) = {my(k = 1, p = prime(n)); while((q=f(p)) != 1, k++; p = q); k;} \\ Michel Marcus, Nov 20 2016
    
  • PARI
    a(n) = my(p=prime(n)); 2 + logint(p, 2) - hammingweight(p); \\ Kevin Ryde, Nov 06 2023

Formula

a(n) = A023416(prime(n)) + 1. - David Wasserman, Apr 08 2008
a(n) = A035103(n) + 1. - Filip Zaludek, Nov 19 2016

Extensions

More terms from David Wasserman, Apr 08 2008
Previous Showing 21-30 of 31 results. Next