A173404
Number of partitions of 1 into up to n powers of 1/2.
Original entry on oeis.org
1, 2, 3, 5, 8, 13, 22, 38, 66, 116, 205, 364, 649, 1159, 2073, 3712, 6650, 11919, 21370, 38322, 68732, 123287, 221158, 396744, 711760, 1276928, 2290904, 4110102, 7373977, 13229810, 23735985, 42585540, 76404334, 137080120, 245941268, 441254018, 791673612
Offset: 1
a(3) = 3: [(1/2)^0], [(1/2)^1,(1/2)^1], [(1/2)^1,(1/2)^2,(1/2)^2].
A323840
Irregular triangle read by rows: T(n,k) is the number of compositions of 2^n into k powers of 2.
Original entry on oeis.org
1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 13, 15, 15, 7, 1, 1, 1, 3, 13, 75, 165, 357, 645, 927, 1095, 957, 627, 299, 91, 15, 1, 1, 1, 3, 13, 75, 525, 1827, 5965, 18315, 51885, 130977, 304953, 646373, 1238601, 2143065, 3331429, 4663967, 5867703
Offset: 0
The first few rows are:
1;
1, 1;
1, 1, 3, 1;
1, 1, 3, 13, 15, 15, 7, 1;
1, 1, 3, 13, 75, 165, 357, 645, 927, 1095, 957, 627, 299, 91, 15, 1;
...
The counts for row 3 arise as follows:
8 (1)
= 4+4 (1)
= 4+2+2 (3)
= 4+2+1+1 or 2+2+2+2 (12+1=13)
= 4+1+1+1+1 or 2+2+2+1+1 (5+10=15)
= 2+2+1+1+1+1 (15)
= 2+1+1+1+1+1+1 (7)
= 1+1+1+1+1+1+1+1 (1)
The rows are a subset of the rows of
A073266.
-
b:= proc(n) option remember; expand(`if`(n=0, 1,
add(x*b(n-2^j), j=0..ilog2(n))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=1..2^n))(b(2^n)):
seq(T(n), n=0..5); # Alois P. Heinz, Mar 31 2021
-
b[n_] := b[n] = Expand[If[n == 0, 1,
Sum[x*b[n - 2^j], {j, 0, Length@IntegerDigits[n, 2]-1}]]];
T[n_] := With[{p = b[2^n]}, Table[Coefficient[p, x, i], {i, 1, 2^n}]];
Table[T[n], {n, 0, 5}] // Flatten (* Jean-François Alcover, Jul 07 2021, after Alois P. Heinz *)
-
from functools import lru_cache
@lru_cache(maxsize=None)
def t(n, k):
if n < k: return 0
if k == 0: return 1 if n == 0 else 0
r = 0
i = 1
while True:
if i > n: break
r += t(n - i, k-1)
i *= 2
return r
def T(n, k): return t(2**n, k) # James Rayman, Mar 30 2021
Comments