A335357 Number of compositions of n such that every subsequence has a different sum.
1, 1, 1, 3, 3, 5, 5, 13, 13, 27, 21, 41, 41, 61, 55, 111, 105, 185, 155, 313, 259, 495, 387, 701, 623, 961, 805, 1419, 1191, 1781, 1481, 2437, 2161, 3387, 2745, 4457, 3965, 5821, 4867, 8223, 6909, 10625, 8591, 14617, 11887, 18735, 14991, 24821, 20291, 32113
Offset: 0
Keywords
Examples
a(7) = 13: 7, 16, 25, 34, 43, 52, 61, 124, 142, 214, 241, 412, 421. a(8) = 13: 8, 17, 26, 35, 53, 62, 71, 125, 152, 215, 251, 512, 521. a(9) = 27: 9, 18, 27, 36, 45, 54, 63, 72, 81, 126, 135, 153, 162, 216, 234, 243, 261, 315, 324, 342, 351, 423, 432, 513, 531, 612, 621. a(10) = 21: 10, 19, 28, 37, 46, 64, 73, 82, 91, 127, 136, 163, 172, 217, 271, 316, 361, 613, 631, 712, 721.
Links
- Fausto A. C. Cariboni, Table of n, a(n) for n = 0..700 (terms 0..100 from Alois P. Heinz)
Programs
-
Maple
b:= proc(n, s) option remember; `if`(n=0, 1, add((h-> `if`(nops(s)* 2=nops(h), b(n-j, h), 0))({s[], map(x-> x+j, s)[]}), j=1..n)) end: a:= n-> b(n, {0}): seq(a(n), n=0..40);
-
Mathematica
b[n_, s_] := b[n, s] = If[n == 0, 1, Sum[Function[h, If[Length[s]* 2 == Length[h], b[n - j, h], 0]][Union@Join[s, s + j]], {j, 1, n}]]; a[n_] := b[n, {0}]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Apr 13 2022, after Alois P. Heinz *)
Comments