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

%I #37 Dec 16 2021 18:07:38

%S 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,

%T 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,

%U 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

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

%H Rick L. Shepherd, <a href="/A080098/b080098.txt">Rows n = 0..500 of triangle, flattened</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/OR.html">OR.</a>

%e Triangle begins:

%e 0,

%e 1, 1,

%e 2, 3, 2,

%e 3, 3, 3, 3,

%e 4, 5, 6, 7, 4,

%e 5, 5, 7, 7, 5, 5,

%e 6, 7, 6, 7, 6, 7, 6,

%e 7, 7, 7, 7, 7, 7, 7, 7,

%e 8, 9, 10, 11, 12, 13, 14, 15, 8,

%e 9, 9, 11, 11, 13, 13, 15, 15, 9, 9,

%e 10, 11, 10, 11, 14, 15, 14, 15, 10, 11, 10,

%e ...

%t T[n_, k_] := n ~BitOr~ k;

%t Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Dec 01 2021 *)

%o (Haskell)

%o import Data.Bits ((.|.))

%o a080098 n k = n .|. k :: Int

%o a080098_row n = map (a080098 n) [0..n]

%o a080098_tabl = map a080098_row [0..]

%o -- _Reinhard Zumkeller_, Aug 03 2014, Jul 05 2012

%o (Python)

%o def T(n, k): return n | k

%o print([T(n, k) for n in range(13) for k in range(n+1)]) # _Michael S. Branicky_, Dec 01 2021

%Y Cf. A001316 (number of integers k such that T(n, k) = n in n-th row).

%Y Cf. A350093 (row sums), A003986 (array).

%Y Other triangles: A080099 (AND), A051933 (XOR), A265705 (IMPL), A102037 (CNIMPL).

%K nonn,easy,tabl,look

%O 0,4

%A _Reinhard Zumkeller_, Jan 28 2003