I am searching a generic mathematical notation for my problem.
Suppose I have an array of length L. This array is always read from left to right (you will understand why this is important). The numbers are all positive integers.
Every value from the left must be greater or equal to the value on the right slot.
So, as an example, I can have an array like so
[6,6,5,4,3,3]
but not
[6,5,6,4,3,3] the 2nd 6 is greater than 5; doesn't work.
Now, I want to find a generalized notation to count all the possibilities for an array of length L to have a specific value k.
An example, count all possibilities for the slots of the array of length 5 to equal 18:
[6,6,4,1,1]
[6,6,3,2,1]
[6,6,2,2,2]
[6,5,4,2,1]
[6,5,3,2,2]
and so on
EDIT: here are two solution sets for: array length: 6, sum: 19, max value: 5. That is 16 results
4,3,3,3,3,3
4,4,3,3,3,2
4,4,4,3,2,2
4,4,4,3,3,1
4,4,4,4,2,1
5,3,3,3,3,2
5,4,3,3,2,2
5,4,3,3,3,1
5,4,4,2,2,2
5,4,4,3,2,1
5,4,4,4,1,1
5,5,3,2,2,2
5,5,3,3,2,1
5,5,4,2,2,1
5,5,4,3,1,1
5,5,5,2,1,1
for: array length: 4, sum: 8, max value: 5. That is 5 results.
2,2,2,2
3,2,2,1
3,3,1,1
4,2,1,1
5,1,1,1
I am wondering how I can express all the possibilities without having to count them one by one.
Reminder: length and sum can be anything but once chosen, they cannot change during the calculation.
Thanks,
Welcome to MSE! Its similar to repetitions.
A $k$-repetition of $n$ is a word $x=x_1x_2\ldots x_n$ of length $n$ over the alphabet ${\Bbb N}_0$ such that $x_1+x_2+\ldots+x_n=k$.
For instance, the word 664111 can be represented as $x=201003$, i.e., 2 symbols 6, 0 symbols 2,3,5, and 3 symbols 1.
The number of such words is $n+k-1 \choose k$.