[go: up one dir, main page]

login
A325557
Number of compositions of n with equal differences up to sign.
20
1, 1, 2, 4, 6, 8, 13, 12, 20, 24, 25, 29, 49, 40, 50, 64, 86, 80, 105, 102, 164, 175, 186, 208, 325, 316, 382, 476, 624, 660, 814, 961, 1331, 1500, 1739, 2140, 2877, 3274, 3939, 4901, 6345, 7448, 9054, 11157, 14315, 17181, 20769, 25843, 32947, 39639, 48257, 60075
OFFSET
0,3
COMMENTS
A composition of n is a finite sequence of positive integers summing to n.
The differences of a sequence are defined as if the sequence were increasing, so for example the differences of (3,1,2) are (-2,1).
EXAMPLE
The a(1) = 1 through a(8) = 20 compositions:
(1) (2) (3) (4) (5) (6) (7) (8)
(11) (12) (13) (14) (15) (16) (17)
(21) (22) (23) (24) (25) (26)
(111) (31) (32) (33) (34) (35)
(121) (41) (42) (43) (44)
(1111) (131) (51) (52) (53)
(212) (123) (61) (62)
(11111) (141) (151) (71)
(222) (232) (161)
(321) (313) (242)
(1212) (12121) (323)
(2121) (1111111) (1232)
(111111) (1313)
(2123)
(2222)
(2321)
(3131)
(3212)
(21212)
(11111111)
MATHEMATICA
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], SameQ@@Abs[Differences[#]]&]], {n, 0, 15}]
PROG
(PARI)
step(R, n, s)={matrix(n, n, i, j, if(i>j, if(j>s, R[i-j, j-s]) + if(j+s<=n, R[i-j, j+s])) )}
w(n, s)={my(R=matid(n), t=0); while(R, R=step(R, n, s); t+=vecsum(R[n, ])); t}
a(n) = {numdiv(max(1, n)) + sum(s=1, n-1, w(n, s))} \\ Andrew Howroyd, Aug 22 2019
KEYWORD
nonn
AUTHOR
Gus Wiseman, May 11 2019
EXTENSIONS
a(26)-a(42) from Lars Blomberg, May 30 2019
Terms a(43) and beyond from Andrew Howroyd, Aug 22 2019
STATUS
approved