[go: up one dir, main page]

login
A368557
Number of compositions of n such that the set of absolute differences is a subset of the set of parts.
1
1, 1, 1, 3, 2, 2, 11, 10, 13, 27, 58, 87, 157, 253, 438, 850, 1462, 2474, 4472, 7716, 13544, 24115, 42360, 74013, 131038, 229009, 401946, 707293, 1242059, 2177682, 3828831, 6716062, 11777179, 20678592, 36267148, 63586772, 111556751, 195610763, 342949281
OFFSET
0,4
EXAMPLE
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.
a(3) = 3 compositions: [3], [2,1], [1,2].
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].
MATHEMATICA
g[0] = {{}}; g[n_Integer] := g[n] = Flatten[ParallelTable[Append[#, i] & /@ g[n - i], {i, 1, n}], 1];
isC[p_List] := Module[{d}, d = Abs[Differences[p]]; Union[d] === Union[Select[d, MemberQ[p, #] &]]];
a[n_Integer] := a[n] = Count[g[n], p_ /; isC[p]];
Monitor[Table[a[n], {n, 0, 19}], {n, Table[a[m], {m, 0, n - 1}]}] (* Robert P. P. McKone, Jan 02 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
John Tyler Rascoe, Dec 29 2023
EXTENSIONS
a(24)-a(38) from Alois P. Heinz, Dec 30 2023
STATUS
approved