login
Triangle read by rows, T(n, k) = 2*n - HammingWeight(k), for 0 <= k <= n.
4

%I #8 Oct 30 2021 06:03:08

%S 0,2,1,4,3,3,6,5,5,4,8,7,7,6,7,10,9,9,8,9,8,12,11,11,10,11,10,10,14,

%T 13,13,12,13,12,12,11,16,15,15,14,15,14,14,13,15,18,17,17,16,17,16,16,

%U 15,17,16,20,19,19,18,19,18,18,17,19,18,18

%N Triangle read by rows, T(n, k) = 2*n - HammingWeight(k), for 0 <= k <= n.

%e Triangle starts:

%e [0] 0;

%e [1] 2, 1;

%e [2] 4, 3, 3;

%e [3] 6, 5, 5, 4;

%e [4] 8, 7, 7, 6, 7;

%e [5] 10, 9, 9, 8, 9, 8;

%e [6] 12, 11, 11, 10, 11, 10, 10;

%e [7] 14, 13, 13, 12, 13, 12, 12, 11;

%e [8] 16, 15, 15, 14, 15, 14, 14, 13, 15;

%e [9] 18, 17, 17, 16, 17, 16, 16, 15, 17, 16;

%p HammingWeight := n -> add(i, i = convert(n, base, 2)):

%p A348684 := (n, k) -> 2*n - HammingWeight(k):

%p seq(seq(A348684(n, k), k = 0..n), n = 0..10);

%t Table[2*n - DigitCount[k, 2, 1], {n, 0, 10}, {k, 0, n}] // Flatten (* _Amiram Eldar_, Oct 30 2021 *)

%Y Cf. A000120, A005843, A005187, A057427 (row gcd).

%Y Cf. A348685, A348687, A348676.

%K nonn,tabl

%O 0,2

%A _Peter Luschny_, Oct 29 2021