Hello,
I'm not a math student, but I need help for the following situation (example):
Have a vector of size n (data structure), filled with values 1:
Example: n = 12
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
I have sequences of zeros of length m.
Example: m = 1
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
Example: m = 2
| 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 |
Example: m = 3
| 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 |
How many combinations are there for a vector of n positions and sequences of zero values up to size m?
Example: For n = 12 and m = 3.
no sequence of zeros
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
combinations of sequences x 1 zeros
| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
combinations of two zero sequences x
| 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 |
combinations of three zeros sequences x
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
combinations of sequences of zeros of different sizes
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
I need the mathematical formula (formal) and a way to get one by one the possible combinations!!
I do not know if I created the topic in the correct place.
Sorry for my terrible english because I speak Portuguese (Brazil).
Thank you!
Luiz Fernando

MENU