Formula to determine the number of possible dice combination to reach certain value I am having a headache to this simple problem.

The goal is to find the number of total combination to reach the target value.

For example:

target = 5
number of combination is 7

5
4, 1
3, 2
3, 1, 1
2, 2, 1
2, 1, 1, 1
1, 1, 1, 1, 1
This helped me for the logic:

en.wikipedia.org/wiki/Partition_(number_theory)

I am a programmer and I needed a function to determine the partition

function partition(goal, maxNumber){

    if (maxNumber==0)
        return 0;
    if (goal==0)
        return 1;
    if (goal&lt;0)
        return 0;

    return partition(goal,maxNumber-1) 
    + partition(goal-maxNumber,maxNumber);
}

var goal = 700;
var maxNumber = 6; //because dice

document.write(partition(goal,maxNumber));
This helped me for the logic:

en.wikipedia.org/wiki/Partition_(number_theory)

I am a programmer and I needed a function to determine the partition

function partition(goal, maxNumber){

    if (maxNumber==0)
        return 0;
    if (goal==0)
        return 1;
    if (goal&lt;0)
        return 0;

    return partition(goal,maxNumber-1) 
    + partition(goal-maxNumber,maxNumber);
}

var goal = 700;
var maxNumber = 6; //because dice

document.write(partition(goal,maxNumber));