# Thread: Place 37 people into 5 rooms so that each room has at least 1 person in it?

1. ## Place 37 people into 5 rooms so that each room has at least 1 person in it?

I know that if i forget about the condition that no room is empty, then i can line 37 people up and assign each to a room to get a sequence with repetition, which means 5 ways to give the first person a room, 5 ways for the second etc until i get $\displaystyle 5^{37}$ possible ways to place 37 people in 5 rooms. But now with the condition that no room is empty? I suppose i could subtract the subcases of 1 room empty,and 37 people in 4 rooms, 2 rooms empty and 37 people in 3 rooms etc, but this seems lengthy and i have a feeling there's a better way?

2. Originally Posted by punkstart
I know that if i forget about the condition that no room is empty, then i can line 37 people up and assign each to a room to get a sequence with repetition, which means 5 ways to give the first person a room, 5 ways for the second etc until i get $\displaystyle 5^{37}$ possible ways to place 37 people in 5 rooms. But now with the condition that no room is empty?
This a matter of counting the number of surjections( onto functions) from a set of 37 to a set of 5.
$\displaystyle \text{Surj}(N,K)=\displaystyle\sum\limits_{j = 0}^K {\left( { - 1} \right)^j \binom{K}{j}\left( {K - j} \right)^N }$

Here $\displaystyle N=37~\&~K=5$