geeloso wrote: |
---|
r u referring to that similar to what u have in a Pascal triangle to determine the coefficients of an n-degree polynomial expansion? |
Yes. Exactly.
Do as
jonnin suggested — write out the examples as, for example, given N=7, K=2:
1 1 1 1 1 1 1
0 0
rewritten as:
1 1 1 1 1 k
The number of possibilities are
6 choose 1
⟶
6
. We can verify this ourselves: 11111(00), 1111(00)1, 111(00)11, 11(00)111, 1(00)1111, (00)11111.
That’s
6, not 7, because each
K digits are treated as if they were a single digit.
Next, we have:
1 1 1 1 1 1 1
0 0 0 0
rewritten as:
1 1 1 k k
The number of possibilites are
5 choose 2
⟶
10
. Again we can verify: 111kk, 11k1k, 11kk1, 1k11k, 1k1k1, 1kk11, k111k, k11k1, k1k11, kk111.
Continuing we get
4
, and then we run out of space for another
K.
Totaling we get
1 + 6 + 10 + 4
⟶
21
possibilities.
Learning to recognize these mathematical patterns is most of the battle.
Hope this helps.