Harold and Jonah each has some oranges, apples, and pears. Each of them has 73 pieces of fruit. Curiously, if for each of them you sum the squares of the number of oranges, apples, and pears, you get 2005 in both cases.
If Harold has six fewer apples than Jonah, and each man has fewer oranges compared to other fruits, what do they have each?
FOR a = 1 TO 73 / 3
FOR b = a + 1 TO (73 - a) / 2
c = 73 - a - b
IF a * a + b * b + c * c = 2005 THEN PRINT a, b, c
NEXT
NEXT
finds
12 30 31
15 22 36
as number sets meeting the criteria.
The 12 and 15 have to be oranges, as they are the low numbers in each set. The only pair of numbers differing by 6 is 30 and 36, so Harold has 30 apples while Jonah has 36, so the top set is Harold's and the bottom is Jonah's.
Harold has 12 oranges, 30 apples and 31 pears.
Jonah has 15 oranges, 36 apples and 22 pears.
|
Posted by Charlie
on 2007-08-06 10:55:43 |