A small question about generating functions

86 Views Asked by At

just a small question: When should I use infinite geometric sequence and when should I use finite geometric sequence when solving problems involving combinations?

For instance, for the problem: How many numbers smaller than 1,000,000 have a digit sum equal to at most 31? What should I use to represent the digits and what's the logic behind it?

Thanks in advance!

1

There are 1 best solutions below

0
On

Note that any nonnegative integer less than $1,000,000$ has exactly $6$ digits, which can range from $0$ to $9$. Now suppose, for example, that we wanted all numbers whose digit sum was exactly $31$. Then we would like to count numbers such as $999400$ and $655555$. For each of the $6$ digits, we are selecting a number from $0$ to $9$ and adding them together. This leads us to the generating function: $$ f(x)=(1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8+x^9)^6 $$ where the coefficient of $x^{31}$ represents the total count of numbers less than $1,000,000$ whose digit sum is exactly $31$. This will involve using a finite geometric series formula, since it terminates at $x^9$. We can't simplify our calculations by allowing the series to be infinite because doing so would involve counting extra "$6$-digit" numbers such as: $$ \boxed{11}\boxed{9}\boxed{0}\boxed{0}\boxed{0}\boxed{11} $$ However, if the desired digit sum had been a number less than $9$ such as $8$, then it would be perfectly acceptable to make the geometric series infinite, since terms like $x^{11}$ could never be used when calculating the coefficient of $x^8$.