A census worker visits the home of a woman. After he knocks on her door, she answers and he can see three kids behind her. He asks about the ages of the children. She says, “The product of their ages is 72. And the sum of their ages is the number on the door.” He checks the door, thinks about it a minute, and then says “I need more information.” She replies, “The oldest one likes strawberries.” He immediately figures out their ages.
How old are the children?
These are the ways of factoring 72 into 3 factors, together with the total of each set:
factors total
1 1 72 74
1 2 36 39
1 3 24 28
1 4 18 23
1 6 12 19
1 8 9 18
2 2 18 22
2 3 12 17
2 4 9 15
2 6 6 14
3 3 8 14
3 4 6 13
There are two sets that add up to 14. The other sets have unique totals.
The woman's last statement indicates that there is an oldest child. The set (2, 6, 6) does not have a unique oldest child, so the ages are 3, 3, and 8.
To produce the above table:
dvs=divisors(72);
for idxa=1:length(dvs)
a=dvs(idxa);
dvs2=divisors(72/a);
for idxb=1:length(dvs2)
b=dvs2(idxb);
if b>=a
c=72/(a*b);
if c>=b
disp([a b c sum([a b c])])
end
end
end
end
|
Posted by Charlie
on 2024-03-29 10:13:27 |