# Find the exponential generating function

Find the exponential generating function for the number of ways to distribute $$r$$ people into six different rooms with between two and four in each room.

I understand that an exponential generating function is of the form: $$a(x) = \sum_{i=0}^{\infty} \frac{a_i}{i!} x^i$$

My approach to it is that since each room can have either 2, 3 or 4 people in it, then we need to account for the cases where $$i=2$$, $$i=3$$, and $$i=3$$. This means that the exponential generating function would be $$\frac{a_2}{2!}x^2 + \frac{a_3}{3!}x^3 + \frac{a_4}{4!}x^4$$

Since each person being distributed can be treated as the same (only the amount of people being distributed matters) then the integer sequence is just going to be $$(1, 1, 1, ...)$$. Plugging in $$a$$ gives us

$$\frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!}$$

However, this equation is just accounting for the number of ways to distribute people in one room. Since there are 6 rooms, and the amount of ways to distribute people in all the room together is just

$$(\frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!})^6$$

Is this correct?

This is the correct exponential generating function. To get the number of ways to distribute $$r$$ (distinguishable!) people into $$6$$ rooms as stated you want:
$$\begin{equation*} \left[ \frac{x^r}{r!} \right] \left( \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} \right)^6 \end{equation*}$$
The algebra to get this for $$r = 12$$ to $$r = 24$$ is tedious, but not hard (use a computer algebra system!).