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

%I #31 Dec 16 2021 02:40:22

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

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

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

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

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

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

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

%e Triangle starts:

%e 0

%e 0 1

%e 0 0 2

%e 0 1 2 3

%e 0 0 0 0 4

%e 0 1 0 1 4 5

%e 0 0 2 2 4 4 6

%e 0 1 2 3 4 5 6 7

%e ...

%t Column[Table[BitAnd[n, k], {n, 0, 15}, {k, 0, n}], Center] (* _Alonso del Arte_, Jun 19 2012 *)

%o (Haskell)

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

%o a080099 n k = n .&. k :: Int

%o a080099_row n = map (a080099 n) [0..n]

%o a080099_tabl = map a080099_row [0..]

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

%o (PARI) T(n,k)=bitand(n,k) \\ _Charles R Greathouse IV_, Jan 26 2013

%o (Python)

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

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

%Y Cf. A080100, A222423 (row sums), A004198 (array).

%Y Other triangles: A080098 (OR), A051933 (XOR), A265705 (IMPL), A102037 (CNIMPL).

%K nonn,easy,tabl,hear,look

%O 0,6

%A _Reinhard Zumkeller_, Jan 28 2003