login
Number of compositions of n such that every subsequence has a different sum.
2

%I #22 Apr 13 2022 07:40:17

%S 1,1,1,3,3,5,5,13,13,27,21,41,41,61,55,111,105,185,155,313,259,495,

%T 387,701,623,961,805,1419,1191,1781,1481,2437,2161,3387,2745,4457,

%U 3965,5821,4867,8223,6909,10625,8591,14617,11887,18735,14991,24821,20291,32113

%N Number of compositions of n such that every subsequence has a different sum.

%C All terms are odd.

%H Fausto A. C. Cariboni, <a href="/A335357/b335357.txt">Table of n, a(n) for n = 0..700</a> (terms 0..100 from Alois P. Heinz)

%e a(7) = 13: 7, 16, 25, 34, 43, 52, 61, 124, 142, 214, 241, 412, 421.

%e a(8) = 13: 8, 17, 26, 35, 53, 62, 71, 125, 152, 215, 251, 512, 521.

%e 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.

%e a(10) = 21: 10, 19, 28, 37, 46, 64, 73, 82, 91, 127, 136, 163, 172, 217, 271, 316, 361, 613, 631, 712, 721.

%p b:= proc(n, s) option remember; `if`(n=0, 1, add((h-> `if`(nops(s)*

%p 2=nops(h), b(n-j, h), 0))({s[], map(x-> x+j, s)[]}), j=1..n))

%p end:

%p a:= n-> b(n, {0}):

%p seq(a(n), n=0..40);

%t b[n_, s_] := b[n, s] = If[n == 0, 1, Sum[Function[h, If[Length[s]*

%t 2 == Length[h], b[n - j, h], 0]][Union@Join[s, s + j]], {j, 1, n}]];

%t a[n_] := b[n, {0}];

%t Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Apr 13 2022, after _Alois P. Heinz_ *)

%Y Cf. A032020, A275972 (the same for partitions).

%K nonn

%O 0,4

%A _Alois P. Heinz_, Jun 03 2020