login
Row sums of triangle A166455.
2

%I #13 Aug 01 2023 06:55:41

%S 1,2,6,12,30,60,124,248,510,1020,2044,4088,8188,16376,32760,65520,

%T 131070,262140,524284,1048568,2097148,4194296,8388600,16777200,

%U 33554428,67108856,134217720,268435440,536870904,1073741808,2147483632,4294967264,8589934590,17179869180

%N Row sums of triangle A166455.

%F a(n) = 2^(n+1) - A001316(n). - _R. J. Mathar_, Oct 30 2009

%e a(3) = 12 = (1 + 5 + 5 + 1).

%t a[n_] := 2^(n+1) - 2^DigitCount[n, 2, 1]; Array[a, 31, 0] (* _Amiram Eldar_, Aug 01 2023 *)

%o (Python)

%o def A000120(n):

%o a = 0

%o while n > 0:

%o a += n % 2

%o n //= 2

%o return a

%o def A001316(n):

%o return 2**A000120(n)

%o def A166456(n):

%o return 2**(n+1) - A001316(n)

%o print([A166456(n) for n in range(80)])

%o # _R. J. Mathar_, Oct 30 2009

%Y Cf. A001316, A166455.

%K nonn

%O 0,2

%A _Gary W. Adamson_, Oct 14 2009

%E Extended by _R. J. Mathar_, Oct 30 2009