Number of Sequences

In a game, one player can score any value from a given array in one play. The final score is determined by multiple plays within specified limits.

For example: if one player can score [2, 3, 6, 7, 8] in each play, and the final score is [7, 10], this calculates the total number of different sequences that can reach each combination.

Formula

$g(m,n) = \begin{cases} 0 & \text{if } m<0 \lor n<0 \\ 1 & \text{if } m=n=0 \\ g(m,n-2)+g(m,n-3)+g(m,n-6)+g(m,n-7)+g(m,n-8)+g(m-2,n)+g(m-3,n)+g(m-6,n)+g(m-7,n)+g(m-8,n) & \text{otherwise} \end{cases}$

Hover over a cell to see its formula breakdown








Back