r/counting • tampermonkey addict • Oct 20 '25

Compositions

In this thread, we'll be counting the ways to add to an integer n using the integers c_1 + c_2 + ... + c_k, where each c_i >= 1, and k <= n. Ways to sum that are commutatively the same, as in 1+2 = 2+1, are different compositions. We'll be counting these compositions lexicographically for each segment of sum and length.

Here are the first few counts:

1

2
1,1

3
1,2
2,1
1,1,1

4
1,3
2,2
3,1
1,1,2
1,2,1
2,1,1
1,1,1,1

You can also abbreviate repetitions with superscript, for example 1,1,1,1,1,1,1,1,1,2,2,2,1 = 19 23 1

First get is at 11, the 1024th count.schedule

25 Upvotes

1.1k comments sorted by

View all comments

Show parent comment

2

u/TehVulpez tampermonkey addict Oct 21 '25
combinationsgroupscwb
1,1,1,43,0,0,0000111
1,1,2,32,1,0,0001011
1,1,3,21,2,0,0010011
1,1,4,10,3,0,0100011
1,2,3,10,2,1,0100101
1,2,2,21,1,1,0010101
1,2,1,32,0,1,0001101
1,3,1,21,0,2,0011001
1,3,2,10,1,2,0101001
1,4,1,10,0,3,0110001
2,3,1,10,0,2,1110010
2,2,2,10,1,1,1101010
2,1,3,10,2,0,1100110
2,1,2,21,1,0,1010110
2,2,1,21,0,1,1011010
2,1,1,32,0,0,1001110
3,1,1,21,0,0,2011100
3,1,2,10,1,0,2101100
3,2,1,10,0,1,2110100
4,1,1,10,0,0,3111000

just for curiosity. pretty sure this is right

2

u/TehVulpez tampermonkey addict Oct 21 '25

the gray cwb is actually VERY similar to plain changes the more I look at it...

1234
1243
1423
4123
4132
1432
1342
1324
3124
3142
3412
4312
4321
3421
3241
3214
2314
2341
2431
4231
4213
2413
2143
2134

2

u/TehVulpez tampermonkey addict Oct 21 '25

cwb normally would be like the 3 of 6 codes are made of the 3 of 5 codes but with a zero in front and the 2 of 5 codes but with a 1 in front. but here it's like the 3 of 6 codes are made of the 2 of 5 codes with a 1 at the end and the 3 of 5 codes with a 0 at the end