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 11-20 of 43 results. Next

A072600 Numbers which in base 2 have fewer 0's than 1's.

Original entry on oeis.org

1, 3, 5, 6, 7, 11, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 39, 43, 45, 46, 47, 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 71, 75, 77, 78, 79, 83, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 99, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Comments

A037861(a(n)) < 0.
b_k = {a(n) | for all n s.t. a(n) contains k binary digits equal to 1} is the list of all valid win/loss round sequences in a "best of 2k-1" two player game, where 1 is a win and 0 is a loss. For example 19 = 10011b represents a game where the winner won the first two rounds, lost the next two, and won the last one. |b_k| = A001700(k). - Philippe Beaudoin, May 14 2014

Examples

			11 is present because '1011' contains 1 '0' and 3 '1's: 1<3.
		

Crossrefs

Programs

  • Haskell
    a072600 n = a072600_list !! (n-1)
    a072600_list = filter ((< 0) . a037861) [0..]
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    Select[Range[130],DigitCount[#,2,0]Harvey P. Dale, Jan 12 2011 *)
  • PARI
    is(n)=2*hammingweight(n)>exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020

A031444 Numbers whose base-2 representation has one more 0 than 1's.

Original entry on oeis.org

4, 17, 18, 20, 24, 67, 69, 70, 73, 74, 76, 81, 82, 84, 88, 97, 98, 100, 104, 112, 263, 267, 269, 270, 275, 277, 278, 281, 282, 284, 291, 293, 294, 297, 298, 300, 305, 306, 308, 312, 323, 325, 326, 329, 330, 332, 337, 338, 340, 344
Offset: 1

Views

Author

Keywords

Comments

If m is a term, then also 4*m+1. - Reinhard Zumkeller, Mar 31 2015

Crossrefs

Cf. A007088, A023416, A000120, A031448, A037861, A095072 (subsequence).
Subsequence of A089648.

Programs

  • Haskell
    a031444 n = a031444_list !! (n-1)
    a031444_list = filter ((== 1) . a037861) [1..]
    -- Reinhard Zumkeller, Mar 31 2015
  • Mathematica
    Select[Range[350], (Differences@ DigitCount[#, 2])[[1]] == 1 &] (* Amiram Eldar, Aug 03 2023 *)

Formula

A037861(a(n)) = 1. - Reinhard Zumkeller, Mar 31 2015

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))

A072603 Numbers which in base 2 have more 0's than 1's.

Original entry on oeis.org

4, 8, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 80, 81, 82, 84, 88, 96, 97, 98, 100, 104, 112, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 140, 144, 145, 146, 148, 152, 160, 161, 162, 164, 168, 176, 192, 193
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Examples

			8 is present because '1000' contains 3 '0's and 1 '1': 3>1.
		

Crossrefs

Programs

  • Haskell
    a072603 n = a072603_list !! (n-1)
    a072603_list = filter ((> 0) . a037861) [1..]
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    gtQ[n_] := Module[{a, b}, {a, b} = DigitCount[n, 2]; b > a]; Select[Range[2^8], gtQ] (* T. D. Noe, Apr 20 2013 *)
    Select[Range[200],DigitCount[#,2,0]>DigitCount[#,2,1]&] (* Harvey P. Dale, Feb 26 2023 *)
  • PARI
    is(n)=2*hammingweight(n)Charles R Greathouse IV, Apr 18 2020

A072601 Numbers which in base 2 have at least as many 1's as 0's.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 71, 75, 77, 78, 79, 83, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 99, 101, 102, 103
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Examples

			8 = 1000_2 is not present (one '1', three '0's).
10 is present because 10=1010_2 contains 2 '0's and 2 '1's: 2<=2;
11 is present because 11=1011_2 contains 1 '0' and 3 '1's: 1<=3.
		

Crossrefs

Cf. A037861(a(n)) <= 0.
Cf. A072600 (#0's < #1's), this seq (#0's <= #1's), A031443 (#0's = #1's).
Cf. A072602 (#0's >= #1's), A072603 (#0's > #1's), A044951 (#0's <> #1's).

Programs

  • Haskell
    a072601 n = a072601_list !! (n-1)
    a072601_list = filter ((<= 0) . a037861) [0..]
    -- Reinhard Zumkeller, Aug 01 2013
    
  • Mathematica
    geQ[n_] := Module[{a, b}, {a, b} = DigitCount[n, 2]; a >= b]; Select[Range[103], geQ] (* T. D. Noe, Apr 20 2013 *)
    Select[Range[110],DigitCount[#,2,1]>=DigitCount[#,2,0]&] (* Harvey P. Dale, Aug 12 2023 *)
  • PARI
    is(n)=2*hammingweight(n)>exponent(n) \\ Charles R Greathouse IV, Apr 18 2020

A072602 Numbers such that in base 2 the number of 0's is >= the number of 1's.

Original entry on oeis.org

2, 4, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 48, 49, 50, 52, 56, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 80, 81, 82, 84, 88, 96, 97, 98, 100, 104, 112, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Examples

			8 is present because '1000' contains 3 '0's and 1 '1': 3 >= 1;
9 is present because '1001' contains 2 '0's and 2 '1's: 2 >= 2.
		

Crossrefs

Programs

  • Haskell
    a072602 n = a072602_list !! (n-1)
    a072602_list = filter ((>= 0) . a037861) [1..]
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    Select[Range[150],DigitCount[#,2,0]>=DigitCount[#,2,1]&] (* Harvey P. Dale, May 09 2012 *)
  • PARI
    is(n)=2*hammingweight(n)<=exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020

Extensions

Edited by N. J. A. Sloane, Jun 23 2009

A177718 a(n) = |(number of 1's in binary representation of prime(n)) - (number of 0's in binary representation of prime(n))|.

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, 1, 5, 1, 5, 5, 1, 1, 3, 5, 3, 7, 5, 5, 5, 7, 7, 4, 2, 0, 2, 0, 0, 0, 2
Offset: 1

Views

Author

Juri-Stepan Gerasimov, May 12 2010, May 18 2010

Keywords

Examples

			a(1)=0 because 2 = 10_2 and abs(1-1) = 0;
a(2)=2 because 3 = 11_2 and abs(0-2) = 2;
a(3)=1 because 5 = 101_2 and abs(1-2) = 1.
		

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:
    A000120 := proc(n) a := 0 ; for d in convert(n,base,2) do if d = 1 then a := a+1 ; end if; end do; a ; end proc:
    A037861 := proc(n) A023416(n)-A000120(n) ; end proc:
    A177718 := proc(n) abs(A037861(ithprime(n))) ; end proc: seq(A177718(n),n=1..120) ; # R. J. Mathar, May 15 2010
    # second Maple program:
    a:= n-> abs(add(2*i-1, i=Bits[Split](ithprime(n)))):
    seq(a(n), n=1..105);  # Alois P. Heinz, Jan 18 2022
  • Mathematica
    nzmnu[n_]:=Module[{z=DigitCount[n,2,0]},Abs[2z-IntegerLength[n,2]]]; nzmnu/@ Prime[Range[110]] (* Harvey P. Dale, Feb 15 2015 *)
  • Python
    from sympy import isprime
    print([abs(bin(n)[2:].count("1") - bin(n)[2:].count("0")) for n in range (0,1000) if isprime(n)]) # Karl-Heinz Hofmann, Jan 18 2022

Formula

a(n) = abs(A014499(n) - A035103(n)).
a(n) = abs(A037861(prime(n))). - R. J. Mathar, May 15 2010

Extensions

Corrected at three or more places by R. J. Mathar, May 15 2010

A095072 Primes in whose binary expansion the number of 0-bits is one more than the number of 1-bits.

Original entry on oeis.org

17, 67, 73, 97, 263, 269, 277, 281, 293, 337, 353, 389, 401, 449, 1039, 1051, 1063, 1069, 1109, 1123, 1129, 1163, 1171, 1187, 1193, 1201, 1249, 1291, 1301, 1321, 1361, 1543, 1549, 1571, 1609, 1667, 1669, 1697, 1801, 4127, 4157, 4211, 4217
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Comments

A010051(a(n)) = 1 and A037861(a(n)) = 1. - Reinhard Zumkeller, Mar 31 2015

Examples

			97 is in the sequence because 97 is a prime and 97_10 = 1100001_2. The number of 0's in 1100001 is 4 and the number of 1's is 3. - _Indranil Ghosh_, Jan 31 2017
		

Crossrefs

Intersection of A000040 and A031444. Subset of A095071.
Cf. A095052.

Programs

  • Haskell
    a095072 n = a095072_list !! (n-1)
    a095072_list = filter ((== 1) . a010051' . fromIntegral) a031444_list
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    Select[Prime[Range[500]], Differences[DigitCount[#, 2]] == {1} &]
  • PARI
    isA095072(n)=my(v=binary(n));#v==2*sum(i=1,#v,v[i])+1&&isprime(n)
    
  • PARI
    forprime(p=2, 4250, v=binary(p); s=0; for(k=1, #v, s+=if(v[k]==0,+1,-1)); if(s==1,print1(p,", ")))
    
  • Python
    #Program to generate the b-file
    from sympy import isprime
    i=1
    j=1
    while j<=200:
        if isprime(i) and bin(i)[2:].count("0")-bin(i)[2:].count("1")==1:
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Jan 31 2017

A258003 Capped binary boundary codes for holeless strictly non-overlapping polyhexes, only the maximal representative from each equivalence class obtained by rotating.

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 127930, 128476, 486838, 503254, 503482, 505306, 505564, 506332, 511450, 511462, 511708, 511804, 513514, 513772, 513778, 514540, 514804, 514936, 2012890, 2012902, 2013916, 2021098, 2021212, 2022124, 2025196, 2039254, 2043610, 2043622, 2045674, 2045788, 2046700
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 1 is a special case, indicating an empty path, which thus ends at the same vertex as where it started from.
A258204(n) gives the count of terms with binary width 2n + 1.

Crossrefs

Intersection of A257250 and A258002.
Subsequence of A258013.
Subsequence: A258005.
Cf. also A258004 (the same terms without the most significant bit, slightly more compact representation).

A056791 Weight of binary expansion of n + length of binary expansion of n.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 8, 9, 8, 9, 9, 10, 7, 8, 8, 9, 8, 9, 9, 10, 8, 9, 9, 10, 9, 10, 10, 11, 8, 9, 9, 10, 9, 10, 10, 11, 9, 10, 10, 11, 10, 11, 11, 12, 8, 9, 9, 10, 9, 10, 10, 11, 9, 10, 10, 11, 10, 11, 11, 12, 9, 10, 10, 11, 10, 11, 11
Offset: 0

Views

Author

N. J. A. Sloane, Sep 01 2000

Keywords

Examples

			12 = 1100 in binary, so a(12)=2+4=6.
		

Crossrefs

Equals A056792 + 1.
Equals A014701 + 2.

Programs

  • Mathematica
    Table[If[n==0,1,s=IntegerDigits[n,2];Total@s+Length@s],{n,0,100}] (* Giorgos Kalogeropoulos, Sep 13 2021 *)
  • PARI
    a(n) = if (n==0, 1, my(b=binary(n)); vecsum(b) + #b); \\ Michel Marcus, Sep 13 2021
    
  • Python
    def a(n): b = bin(n)[2:]; return b.count('1') + len(b)
    print([a(n) for n in range(87)]) # Michael S. Branicky, Sep 13 2021

Formula

a(n) = a((n - n mod 2) / (2 - n mod 2)) + 1 for n>0, a(0)=1. - Reinhard Zumkeller, Jul 29 2002
a(2n) = a(n)+1, a(2n+1) = a(n)+2. G.f.: 1 + 1/(1-x) * sum(k>=0, (2t+t^2)/(1+t), t=x^2^k). For n>0, a(n) = 2*A000120(n) + A080791(n) = A000120(n) + A029837(n). - Ralf Stephan, Jun 14 2003

Extensions

More terms from James Sellers, Sep 06 2000 and from David W. Wilson, Sep 07 2000
Previous Showing 11-20 of 43 results. Next