Suppose there is a vending machine where you have to pay $100. You have an unlimited amount of 1 dollar, 2 dollar and 5 dollar coins. How many ways can you pay when the order in which you pay the coins does not matter? Also, find the ways when the order matters.
Using generating functions, I solved the first part, i.e., we need to find the coefficient of $x^{100}$ in $$(1+x + x^2 + \dots)(1+x^2 +x^4+ \dots)(1+x^5+x^{10}+\dots).$$
However, I am stuck in the second part. How do we maintain the order while finding the number of ways?
You could use the recursion $$f(n)=f(n-1)+f(n-2)+f(n-5)$$