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-10 of 10 results.

A080100 a(n) = 2^(number of 0's in binary representation of n).

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 2, 1, 8, 4, 4, 2, 4, 2, 2, 1, 16, 8, 8, 4, 8, 4, 4, 2, 8, 4, 4, 2, 4, 2, 2, 1, 32, 16, 16, 8, 16, 8, 8, 4, 16, 8, 8, 4, 8, 4, 4, 2, 16, 8, 8, 4, 8, 4, 4, 2, 8, 4, 4, 2, 4, 2, 2, 1, 64, 32, 32, 16, 32, 16, 16, 8, 32, 16, 16, 8, 16, 8, 8, 4, 32, 16, 16, 8, 16, 8, 8, 4, 16, 8, 8, 4, 8, 4
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 28 2003

Keywords

Comments

Number of numbers k, 0<=k<=n, such that (k AND n) = 0 (bitwise logical AND): a(n) = #{k : T(n,k)=n, 0<=k<=n}, where T is defined as in A080099.
Same parity as the Catalan numbers (A000108). - Paul D. Hanna, Nov 14 2012

Crossrefs

Cf. A001316.
Cf. A002487.
This is Guy Steele's sequence GS(5, 3) (see A135416).
Cf. A048896.

Programs

  • Haskell
    import Data.List (transpose)
    a080100 n = a080100_list !! n
    a080100_list =  1 : zs where
       zs =  1 : (concat $ transpose [map (* 2) zs, zs])
    -- Reinhard Zumkeller, Aug 27 2014, Mar 07 2011
    
  • Maple
    a:= n-> 2^add(1-i, i=Bits[Split](n)):
    seq(a(n), n=0..93);  # Alois P. Heinz, Aug 18 2025
  • Mathematica
    f[n_] := 2^DigitCount[n, 2, 0]; f[0] = 1; Array[f, 94, 0] (* Robert G. Wilson v *)
  • PARI
    a(n)=if(n<1,n==0,(2-n%2)*a(n\2))
    
  • PARI
    a(n)=local(A,m); if(n<0,0,m=1; A=1+O(x); while(m<=n,m*=2; A=subst(A,x,x^2)*(2+x)-1); polcoeff(A,n))
    
  • Python
    def A080100(n): return 1<Chai Wah Wu, Aug 18 2025

Formula

G.f. satisfies: F(x^2) = (1+F(x))/(x+2). - Ralf Stephan, Jun 28 2003
a(2n) = 2a(n), n>0. a(2n+1) = a(n). - Ralf Stephan, Apr 29 2003
a(n) = 2^A080791(n). a(n)=2^A023416(n), n>0.
a(n) = sum(k=0, n, C(n+k, k) mod 2). - Benoit Cloitre, Mar 06 2004
a(n) = sum(k=0, n, C(2n-k, n) mod 2). - Paul Barry, Dec 13 2004
G.f. satisfies: A(x) = Sum_{n>=0} [A(x)^n (mod 2)]*x^n, where A(x)^n (mod 2) reduces all coefficients modulo 2 to {0,1}. - Paul D. Hanna, Nov 14 2012

Extensions

Keyword base added by Rémy Sigrist, Jan 18 2018

A265705 Triangle read by rows: T(n,k) = k IMPL n, 0 <= k <= n, bitwise logical IMPL.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 15 2015

Keywords

Examples

			.          10 | 1010                            12 | 1100
.           4 |  100                             6 |  110
.   ----------+-----                     ----------+-----
.   4 IMPL 10 | 1011 -> T(10,4)=11       6 IMPL 12 | 1101 -> T(12,6)=13
.
First 16 rows of the triangle, where non-symmetrical rows are marked, see comment concerning A158582 and A089633:
.   0:                                 0
.   1:                               1   1
.   2:                             3   2   3
.   3:                           3   3   3   3
.   4:                         7   6   5   4   7    X
.   5:                       7   7   5   5   7   7
.   6:                     7   6   7   6   7   6   7
.   7:                   7   7   7   7   7   7   7   7
.   8:                15  14  13  12  11  10   9   8  15    X
.   9:              15  15  13  13  11  11   9   9  15  15    X
.  10:            15  14  15  14  11  10  11  10  15  14  15    X
.  11:          15  15  15  15  11  11  11  11  15  15  15  15
.  12:        15  14  13  12  15  14  13  12  15  14  13  12  15    X
.  13:      15  15  13  13  15  15  13  13  15  15  13  13  15  15
.  14:    15  14  15  14  15  14  15  14  15  14  15  14  15  14  15
.  15:  15  15  15  15  15  15  15  15  15  15  15  15  15  15  15  15 .
		

Crossrefs

Cf. A003817, A007088, A029578, A089633, A158582, A247648, A265716 (central terms), A265736 (row sums).
Other triangles: A080099 (AND), A080098 (OR), A051933 (XOR), A102037 (CNIMPL).

Programs

  • Haskell
    a265705_tabl = map a265705_row [0..]
    a265705_row n = map (a265705 n) [0..n]
    a265705 n k = k `bimpl` n where
       bimpl 0 0 = 0
       bimpl p q = 2 * bimpl p' q' + if u <= v then 1 else 0
                   where (p', u) = divMod p 2; (q', v) = divMod q 2
    
  • Julia
    using IntegerSequences
    for n in 0:15 println(n == 0 ? [0] : [Bits("IMP", k, n) for k in 0:n]) end  # Peter Luschny, Sep 25 2021
  • Maple
    A265705 := (n, k) -> Bits:-Implies(k, n):
    seq(seq(A265705(n, k), k=0..n), n=0..11); # Peter Luschny, Sep 23 2019
  • Mathematica
    T[n_, k_] := If[n == 0, 0, BitOr[2^Length[IntegerDigits[n, 2]]-1-k, n]];
    Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten (* Jean-François Alcover, Sep 25 2021, after David A. Corneth's PARI code *)
  • PARI
    T(n, k) = if(n==0,return(0)); bitor((2<David A. Corneth, Sep 24 2021
    

Formula

T(n,0) = T(n,n) = A003817(n).
T(2*n,n) = A265716(n).
Let m = A089633(n): T(m,k) = T(m,m-k), k = 0..m.
Let m = A158582(n): T(m,k) != T(m,m-k) for at least one k <= n.
Let m = A247648(n): T(2*m,m) = 2*m.
For n > 0: A029578(n+2) = number of odd terms in row n; no even terms in odd-indexed rows.
A265885(n) = T(prime(n),n).
A053644(n) = smallest k such that row k contains n.

A080098 Triangle T(n,k) = n OR k, 0 <= k <= n, bitwise logical OR, read by rows.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 28 2003

Keywords

Examples

			Triangle begins:
   0,
   1,  1,
   2,  3,  2,
   3,  3,  3,  3,
   4,  5,  6,  7,  4,
   5,  5,  7,  7,  5,  5,
   6,  7,  6,  7,  6,  7,  6,
   7,  7,  7,  7,  7,  7,  7,  7,
   8,  9, 10, 11, 12, 13, 14, 15,  8,
   9,  9, 11, 11, 13, 13, 15, 15,  9,  9,
  10, 11, 10, 11, 14, 15, 14, 15, 10, 11, 10,
  ...
		

Crossrefs

Cf. A001316 (number of integers k such that T(n, k) = n in n-th row).
Cf. A350093 (row sums), A003986 (array).
Other triangles: A080099 (AND), A051933 (XOR), A265705 (IMPL), A102037 (CNIMPL).

Programs

  • Haskell
    import Data.Bits ((.|.))
    a080098 n k = n .|. k :: Int
    a080098_row n = map (a080098 n) [0..n]
    a080098_tabl = map a080098_row [0..]
    -- Reinhard Zumkeller, Aug 03 2014, Jul 05 2012
    
  • Mathematica
    T[n_, k_] := n ~BitOr~ k;
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, Dec 01 2021 *)
  • Python
    def T(n, k): return n | k
    print([T(n, k) for n in range(13) for k in range(n+1)]) # Michael S. Branicky, Dec 01 2021

A213370 a(n) = n AND 2*n, where AND is the bitwise AND operator.

Original entry on oeis.org

0, 0, 0, 2, 0, 0, 4, 6, 0, 0, 0, 2, 8, 8, 12, 14, 0, 0, 0, 2, 0, 0, 4, 6, 16, 16, 16, 18, 24, 24, 28, 30, 0, 0, 0, 2, 0, 0, 4, 6, 0, 0, 0, 2, 8, 8, 12, 14, 32, 32, 32, 34, 32, 32, 36, 38, 48, 48, 48, 50, 56, 56, 60, 62, 0, 0, 0, 2, 0, 0, 4, 6, 0, 0, 0, 2, 8, 8
Offset: 0

Views

Author

Alex Ratushnyak, Jun 14 2012

Keywords

Crossrefs

Cf. A003714: indices of 0's.
Cf. A213540: indices of 2's, indices of 4's divided by 2.

Programs

  • Mathematica
    Table[BitAnd[n, 2n], {n, 0, 63}] (* Alonso del Arte, Jun 19 2012 *)
  • PARI
    a(n) = bitand(n, 2*n); \\ Michel Marcus, Mar 26 2021
  • Python
    for n in range(99):
        print(2*n & n, end=", ")
    

Formula

a(n) = 2 * A048735(n).
a(n) = (1/2)*(A048727(n) XOR A269160(n)) = (n OR 2n) XOR (n XOR 2n). - Antti Karttunen, May 16 2021

A051933 Triangle T(n,m) = Nim-sum (or XOR) of n and m, read by rows, 0<=m<=n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 20 1999

Keywords

Examples

			{0},
{1,0},
{2,3,0},
{3,2,1,0}, ...
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games, Academic Press, p. 52.

Crossrefs

Cf. A224915 (row sums), A003987 (array), A051910 (Nim-product).
Other triangles: A080099 (AND), A080098 (OR), A265705 (IMPL), A102037 (CNIMPL), A002262 (k).

Programs

  • Haskell
    import Data.Bits (xor)
    a051933 n k = n `xor` k :: Int
    a051933_row n = map (a051933 n) [0..n]
    a051933_tabl = map a051933_row [0..]
    -- Reinhard Zumkeller, Aug 02 2014, Aug 13 2013
    
  • Julia
    using IntegerSequences
    A051933Row(n) = [Bits("XOR", n, k) for k in 0:n]
    for n in 0:10 println(A051933Row(n)) end  # Peter Luschny, Sep 25 2021
  • Maple
    nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^20,base,2); t2 := convert(b+2^20,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
    AT := array(0..N,0..N); for a from 0 to N do for b from a to N do AT[a,b] := nimsum(a,b); AT[b,a] := AT[a,b]; od: od:
    # Alternative:
    A051933 := (n, k) -> Bits:-Xor(n, k):
    seq(seq(A051933(n, k), k=0..n), n=0..12); # Peter Luschny, Sep 23 2019
  • Mathematica
    Flatten[Table[BitXor[m, n], {m, 0, 12}, {n, 0, m}]] (* Jean-François Alcover, Apr 29 2011 *)

Extensions

More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999

A222423 Sum of (n AND k) for k = 0, 1, 2, ..., n, where AND is the bitwise AND operator.

Original entry on oeis.org

0, 1, 2, 6, 4, 11, 18, 28, 8, 21, 34, 50, 60, 79, 98, 120, 16, 41, 66, 94, 116, 147, 178, 212, 216, 253, 290, 330, 364, 407, 450, 496, 32, 81, 130, 182, 228, 283, 338, 396, 424, 485, 546, 610, 668, 735, 802, 872, 816, 889, 962, 1038, 1108, 1187, 1266, 1348, 1400
Offset: 0

Views

Author

Alex Ratushnyak, Feb 23 2013

Keywords

Comments

If n = 2^x, (n AND k) = 0 for k < n, therefore a(n) = n if and only if n = 0 or n = 2^x.
Row sums of A080099. - R. J. Mathar, Apr 26 2013
The associated incomplete sum_{0<=kA213673(n). - R. J. Mathar, Aug 22 2013

Examples

			a(3) = 6 because 1 AND 3 = 1; 2 AND 3 = 2; 3 AND 3 = 3; and 1 + 2 + 3 = 6.
a(4) = 4 because 1 AND 4 = 0; 2 AND 4 = 0; 3 AND 4 = 0; 4 AND 4 = 4; and 0 + 0 + 0 + 4 = 4.
a(5) = 11 because 1 AND 5 = 1; 2 AND 5 = 0; 3 AND 5 = 1; 4 AND 5 = 4; 5 AND 5 = 5; and 1 + 0 + 1 + 4 + 5 = 11.
		

Crossrefs

Cf. A004125.

Programs

  • Mathematica
    Table[Sum[BitAnd[n, k], {k, 0, n}], {n, 0, 63}] (* Alonso del Arte, Feb 24 2013 *)
  • PARI
    a(n) = sum(k=0, n, bitand(n, k)); \\ Michel Marcus, May 17 2015
  • Python
    for n in range(99):
        s = 0
        for k in range(n+1):
            s += n & k
        print(s, end=",")
    

Formula

a(2^n-1) = A006516(n) for all n, since k AND 2^n-1 = k for all k<2^n. - M. F. Hasler, Feb 28 2013

A102210 Number of primes that are bitwise covered by n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 30 2004

Keywords

Comments

p is bitwise covered by n iff (p = (n AND p)) bitwise: A080099(n,p)=p.

Examples

			n=21->10101 -> a(21) = #{00101=5,10001=17} = 2.
		

Crossrefs

Programs

Formula

a(A102211(n)) = 0; a(A102212(n)) = 1; a(A102213(n)) > 1.
a(2^k-1) = A007053(k) for k > 1. - Amiram Eldar, Jan 12 2020

A102037 Triangle of BitAnd(BitNot(n), k).

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Dec 25 2004

Keywords

Comments

As a logical operation on two variables this is also called the 'converse nonimplication'. - Peter Luschny, Sep 25 2021

Examples

			Table starts:
[0] 0;
[1] 0, 0;
[2] 0, 1, 0;
[3] 0, 0, 0, 0;
[4] 0, 1, 2, 3, 0;
[5] 0, 0, 2, 2, 0, 0;
[6] 0, 1, 0, 1, 0, 1, 0;
[7] 0, 0, 0, 0, 0, 0, 0, 0;
[8] 0, 1, 2, 3, 4, 5, 6, 7, 0;
[9] 0, 0, 2, 2, 4, 4, 6, 6, 0, 0.
		

Crossrefs

Cf. A350094 (row sums), A268040 (array).
Other triangles: A080099 (AND), A080098 (OR), A051933 (XOR), A265705 (IMPL).

Programs

  • Julia
    using IntegerSequences
    A102037Row(n) = [Bits("CNIMP", n, k) for k in 0:n]
    for n in 0:20 println(A102037Row(n)) end  # Peter Luschny, Sep 25 2021
  • Maple
    with(Bits): cnimp := (n, k) -> And(Not(n), k):
    seq(print(seq(cnimp(n,k), k=0..n)), n = 0..12); # Peter Luschny, Sep 25 2021

A102550 Number of distinct prime-factors of n that are bitwise covered by n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 14 2005

Keywords

Comments

p is bitwise covered by n iff (p = (n AND p)) bitwise: A080099(n,p)=p.

Crossrefs

Programs

  • Mathematica
    a[1] = 0; a[k_] := Module[{f=FactorInteger[k][[;; , 1]]}, Count[BitAnd[k, f]-f, 0]];  Array[a,120] (* Amiram Eldar, Feb 06 2019 *)

Formula

a(A102553(n)) = A001221(A102553(n));
a(A102554(n)) < A001221(A102554(n));
a(A102551(n)) = 0, a(A102551(n)) > 0;
a(A102555(n)) = n;
a(m) < n for m < A102555(n).
a(n) = Sum_{p|n} (binomial(n,p) mod 2), where p is a prime. - Ridouane Oudra, May 03 2019

Extensions

Offset 1 from Amiram Eldar, Feb 06 2019

A327853 Triangle read by rows, Sierpinski's gasket, A047999 * (0,1,2,3,4,...) diagonalized.

Original entry on oeis.org

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

Views

Author

Matej Veselovac, Sep 28 2019

Keywords

Comments

This is similar to A166555, the difference being that this is scaled "linearly" instead of exponentially.
The scatterplot of the sequence resembles Sierpinski's gasket (triangle), with a square root border (the "linear" scaling is not normalized and actually resembles the scale of the function of the positive inverse of triangular numbers: A003056).
If instead of (0,1,2,3,4,...), we use the A000217 (triangular numbers), then the border of the scatterplot will be truly linear.

Examples

			First 16 rows of the triangle:
  0;
  0, 1;
  0, 0, 2;
  0, 1, 2, 3;
  0, 0, 0, 0, 4;
  0, 1, 0, 0, 4, 5;
  0, 0, 2, 0, 4, 0, 6;
  0, 1, 2, 3, 4, 5, 6, 7;
  0, 0, 0, 0, 0, 0, 0, 0, 8;
  0, 1, 0, 0, 0, 0, 0, 0, 8, 9;
  0, 0, 2, 0, 0, 0, 0, 0, 8, 0, 10;
  0, 1, 2, 3, 0, 0, 0, 0, 8, 9, 10, 11;
  0, 0, 0, 0, 4, 0, 0, 0, 8, 0,  0,  0, 12;
  0, 1, 0, 0, 4, 5, 0, 0, 8, 9,  0,  0, 12, 13;
  0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 10,  0, 12,  0, 14;
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15;
		

Crossrefs

Cf. A166555 (2^k is used instead of k).
Cf. A080099 (similar scatterplot visualization).
Cf. A327889 (alternating, normalized (linear) modification of the sequence, transformed by first decimal digit indicator function).

Programs

  • Mathematica
    r[n0_]:=Flatten[Table[(k)(Mod[Binomial[n,k],2]),{n,0,n0},{k,0,n}]]; r[20] (* Matej Veselovac, Sep 28 2019 *)

Formula

Triangle read by rows, A047999 * Q. A047999 = Sierpinski's gasket, Q = an infinite lower triangular matrix with (0,1,2,3,...) as the main diagonal and the rest zeros.
The entries of the triangle are given by T(n, k) = k * (binomial(n, k) (mod 2)), then it is read by rows.
Showing 1-10 of 10 results.