For each positive integer n, define s(n) to equal the sum of the digits of n. The number of integers n with 100 ≤ n ≤ 999 and 7 ≤ s(n) ≤ 11 is S.

582 Views Asked by At

So we have a question that goes

For each positive integer n, define s(n) to equal the sum of the digits of n. For example, s(2023) = 2 + 0 + 2 + 3. The number of integers n with 100 ≤ n ≤ 999 and 7 ≤ s(n) ≤ 11 is S. What is the integer formed by the rightmost two digits of S?

Do we use a generating function to solve this and on a related note how does one find out a generating function for any given problem. If I see that I want to find lets say the number of sets divisible by 5 and there is a generating function to solve it how do I find it for any arbitrary problem. Is it by chance or what.

1

There are 1 best solutions below

0
On

Break into cases based on the specific sum. Apply stars-and-bars and temporarily ignore that ten and eleven are not valid digits. We will subtract the bad cases later.

To have a diophantine sum $x_1+x_2+x_3=n$ with $x_1\geq 1$ and $x_2,x_3\geq 0$, this is solved with stars-and-bars. First, make a change of variable $y_1=x_1-1$ and consider $y_1+x_2+x_3$ instead. There will be a total of $\binom{(n-1)+3-1}{3-1}$ valid outcomes.

We would have then $\binom{8}{2}+\binom{9}{2}+\binom{10}{2}+\binom{11}{2}+\binom{12}{2}$ but we will have included a few incorrect outcomes which can be easily counted by hand.

Letting $A$ represent the digit for ten and $B$ the digit for eleven, we will have accidentally counted $A00,~B00,~A10,~A01,~1A0,$ and $10A$ so we need to remove six from our answer to get a final total of:

$$\binom{8}{2}+\binom{9}{2}+\binom{10}{2}+\binom{11}{2}+\binom{12}{2}-6=224$$