i have an advanced counting problem:

given the intergers 1..1000015, how many intergers are there, whose sum of digits equals 15?

i solved this problem brute force in ocaml, but this wasn't really the task ^^ (solution is 13992)

i think that i have to use the formula for the problem which can be illustrated by asking: " how many possibilites are there to give n coins to m children?"

formula:

i have no clue how to apply the formula to my current problem.