Professional Documents
Culture Documents
number of urinals. If M>5 then the third peer will go into the middle urinal. This means that the
larger problem can be split up into two smaller problems on either side of the middle peer. For
instance if there are 7 urinals the third peer will go into the middle (4th urinal) so that it looks like
this:
X--X--X
X - - X and X - - X
If M is odd then the maximum number of peers that can be fit in N(M) is N(M)=2* N((M+1)/2)-1.
If M is even then the middle peer splits the problem into two uneven smaller problems. e.g. with 8
peeers below:
X--X---X
You can apply this formula to graph the the maximum number of peeers for each number of urinals:
100
Number of peeers
80
60
40
20
0
1
10
19
28
37
46
55
64
73
82
91
100
109
118
127
136
145
154
163
172
181
190
199
208
217
226
Number of urinals
You can then with this data find the minimum number of urinals for a given number of peers:
120
100
80
60
40
20
0
1 3 5 7 9 11131517192123252729313335373941434547495153555759616365
Looking at the graph I then noticed the pattern described in the solution.