You work out the general answer by noticing the pattern in Q1b, and thinking about how that pattern arises.

The exclamation point indicates factorial, the product of all the integers from n down to 1.

For instance 5! = 5 * 4 * 3 * 2 * 1

You should be noticing something like that popping up as you work out Q1a.