login
Number of compositions of n such that the set of absolute differences is a subset of the set of parts.
1

%I #26 Jan 31 2024 08:06:36

%S 1,1,1,3,2,2,11,10,13,27,58,87,157,253,438,850,1462,2474,4472,7716,

%T 13544,24115,42360,74013,131038,229009,401946,707293,1242059,2177682,

%U 3828831,6716062,11777179,20678592,36267148,63586772,111556751,195610763,342949281

%N Number of compositions of n such that the set of absolute differences is a subset of the set of parts.

%H John Tyler Rascoe, <a href="/A368557/a368557.py.txt">Python program</a>

%e For n=12, composition [2,1,2,4,3] of 12 has the set of absolute differences {1,2}, which is a subset of the set of parts {1,2,3,4}, so it counts towards a(12) = 157.

%e a(3) = 3 compositions: [3], [2,1], [1,2].

%e a(6) = 11 compositions: [6], [4,2], [2,4], [3,2,1], [3,1,2], [2,3,1], [2,1,3], [1,3,2], [1,2,3], [2,1,2,1], [1,2,1,2].

%t g[0] = {{}}; g[n_Integer] := g[n] = Flatten[ParallelTable[Append[#, i] & /@ g[n - i], {i, 1, n}], 1];

%t isC[p_List] := Module[{d}, d = Abs[Differences[p]]; Union[d] === Union[Select[d, MemberQ[p, #] &]]];

%t a[n_Integer] := a[n] = Count[g[n], p_ /; isC[p]];

%t Monitor[Table[a[n], {n, 0, 19}], {n, Table[a[m], {m, 0, n - 1}]}] (* _Robert P. P. McKone_, Jan 02 2024 *)

%Y Cf. A003242, A032020, A173258, A214248, A214270.

%K nonn

%O 0,4

%A _John Tyler Rascoe_, Dec 29 2023

%E a(24)-a(38) from _Alois P. Heinz_, Dec 30 2023