How many ways can we combine $1, 2$ and $5$ dollars into a vending machine, in a total sum of $n$ - no need to get a closed form expression, just show the generating function. differentiate between ordered and unordered cases. (Without using exponential generating function)
My Attempt -
So the unordered case feels kind of obvious - I define $x_1 = 1+x+x^2+..., x_2 = 1+x^2+x^4+...,x_5=1+x^5+x^{10}+...$ , $x_1 + x_2 + x_5 = n$. And the generating function as such - $f(x) = \lambda x\in \Bbb{R}. \dfrac{1}{1-x} \cdot \dfrac{1}{1-x^2} \cdot \dfrac{1}{1-x^5}$.
The second case is a little bit more confusing, i thought about something like -
$f(x) = \lambda x\in\Bbb{R}.\sum\limits_{i=0}^n(1+x+x^2+x^5)^i$
I really am not sure this is a good generating function for that case, any thoughts ?
For counting unordered cases you can use recursive function $F(n;5,2,1)$ wich gives number of combines 1,2 and 5 dollars for represent $n$ dollars. For $n=8$:
$F(8;5,2,1)=F(3;2,1)+F(8;2,1)=F(1;1)+F(3;1)+F(6;2,1)+F(8;1)=1+1+F(4;2,1)+F(6;1)+1= 2+F(2;2,1)+F(4;1)+2=2+F(2;2,1)+F(4;1)+2=2+2+1+2=7$.