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.

A350094 a(n) = Sum_{k=0..n} n CNIMPL k where CNIMPL = NOT(n) AND k is the bitwise logical converse non-implication operator (A102037).

Original entry on oeis.org

0, 0, 1, 0, 6, 4, 3, 0, 28, 24, 21, 16, 18, 12, 7, 0, 120, 112, 105, 96, 94, 84, 75, 64, 84, 72, 61, 48, 42, 28, 15, 0, 496, 480, 465, 448, 438, 420, 403, 384, 396, 376, 357, 336, 322, 300, 279, 256, 360, 336, 313, 288, 270, 244, 219, 192, 196, 168, 141, 112
Offset: 0

Views

Author

Kevin Ryde, Dec 14 2021

Keywords

Comments

The effect of NOT(n) AND k is to retain from k only those bits where n has a 0-bit. Conversely n AND k retains from k those bits where n has a 1-bit. Together they are all bits of k so that a(n) + A222423(n) = Sum_{k=0..n} k = n*(n+1)/2.

Crossrefs

Row sums of A102037.
Cf. A001196 (bit doubling).
Other sums: A222423 (AND), A350093 (OR), A224915 (XOR), A265736 (IMPL).

Programs

  • Maple
    with(Bits): cnimp := (n, k) -> And(Not(n), k):
    seq(add(cnimp(n, k), k = 0..n), n = 0..59); # Peter Luschny, Dec 14 2021
  • PARI
    a(n) = (3*fromdigits(binary(n),4) - n^2 - 2*n)/4;

Formula

a(n) = (A001196(n) - n*(n+2))/4.
a(2*n) = 4*a(n) + n.
a(2*n+1) = 4*a(n).

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

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

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 28 2003

Keywords

Comments

A080100(n) = number of numbers k such that n AND k = 0 in n-th row of the triangular array.

Examples

			Triangle starts:
0
0 1
0 0 2
0 1 2 3
0 0 0 0 4
0 1 0 1 4 5
0 0 2 2 4 4 6
0 1 2 3 4 5 6 7
...
		

Crossrefs

Cf. A080100, A222423 (row sums), A004198 (array).
Other triangles: A080098 (OR), A051933 (XOR), A265705 (IMPL), A102037 (CNIMPL).

Programs

  • Haskell
    import Data.Bits ((.&.))
    a080099 n k = n .&. k :: Int
    a080099_row n = map (a080099 n) [0..n]
    a080099_tabl = map a080099_row [0..]
    -- Reinhard Zumkeller, Aug 03 2014, Jul 05 2012
    
  • Mathematica
    Column[Table[BitAnd[n, k], {n, 0, 15}, {k, 0, n}], Center] (* Alonso del Arte, Jun 19 2012 *)
  • PARI
    T(n,k)=bitand(n,k) \\ Charles R Greathouse IV, Jan 26 2013
    
  • Python
    def T(n, k): return n & k
    print([T(n, k) for n in range(14) for k in range(n+1)]) # Michael S. Branicky, Dec 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
Showing 1-5 of 5 results.