The Smiths, the Andrings and the Cliffords all hold a big party. Everyone shakes hands with every member of the other two families (no one shakes hands with members of their own family), 142 handshakes in all.
Assuming that there at least as many Andrings as Smiths, and at least as many Cliffords as Andrings, how many of each family are present?
(In reply to
re(2): Solution - no brute force? by fwaff)
We are looking for three numbers M, N and P such that MN+NP+PM=142. If two or three of them were odd, the sum would be odd, so those cases are out. If they were all even, the sum would have to be a multiple of four, so that's out too. To sum it up, we have two even numbers and an odd one.
Let's say M=2M', N=2N', P=2P'+1. Calculating and simplifying we get to 2M'N'+2N'P'+2M'P'+M'+N'=71. Thus, M' must be even and N' must be odd, so M'=2M" and N'=2N"+1.
Calculating again we get to 4M"N"+2M"P'+2N"P'+3M"+N"+P'=35. Thus, M"N"<9, and we have few cases to analyze. (Also, remember M\">0 since M>0.) Given M" and N", P'=(35-4M"N"-3M"-N")/(1+2M"+2N"), which must be an integer. M"=3 and N"=2 produces the only integer solution (P'=0), which works out to M=12, N=10, P=1.