A096137 Table read by rows: row n contains the sum of each nonempty subset of {1, 2, ..., n}. In each row, the sums are arranged in ascending order.
1, 1, 2, 3, 1, 2, 3, 3, 4, 5, 6, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12
Offset: 1
Examples
The nonempty subsets of {1, 2, 3} are {1}, {2}, {3}, {1,2}, {1,3}, {2,3} and {1,2,3}, which have sums 1, 2, 3, 3, 4, 5 and 6 respectively, so these are the terms of row 3. Triangle T(n,k) begins: 1; 1, 2, 3; 1, 2, 3, 3, 4, 5, 6; 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10; ...
Links
- Alois P. Heinz, Rows n = 1..15, flattened
Programs
-
Maple
T:= proc(n) option remember; `if`(n=0, [][], subsop(1=[][], sort(map(x-> (x, x+n), [0, T(n-1)])))[]) end: seq(T(n), n=1..7); # Alois P. Heinz, Jul 24 2019
-
Mathematica
T[n_] := T[n] = Total /@ Subsets[Range[n], {1, n}] // Sort; Array[T, 7] // Flatten (* Jean-François Alcover, Feb 14 2021 *)
Extensions
Edited and extended by David Wasserman, Oct 04 2007
Comments