2450 = 2 * 5 * 5 * 7 * 7
The following program produces all sets of three integers that multiply out to 2450 where no integer exceeds 120:
CLS
FOR twos1 = 0 TO 1
rem2s = 1 - twos1
FOR fives1 = 0 TO 2
rem5s = 2 - fives1
FOR sevens1 = 0 TO 2
rem7s = 2 - sevens1
FOR twos2 = 0 TO rem2s
FOR fives2 = 0 TO rem5s
FOR sevens2 = 0 TO rem7s
a = INT(2 ^ twos1 * 5 ^ fives1 * 7 ^ sevens1 + .5)
b = INT(2 ^ twos2 * 5 ^ fives2 * 7 ^ sevens2 + .5)
c = 2450 / (a * b)
IF a <= b AND b <= c AND c <= 120 THEN
PRINT a; b; c, (a + b + c) / 2
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
The list, sorted by (a+b+c)/2 (Jim's age) and reformatted is:
a b c (a+b+c)/2
(Jim's age)
7 14 25 23
7 10 35 26
5 14 35 27
7 7 50 32
5 10 49 32
2 35 35 36
2 25 49 38
5 7 70 41
1 49 50 50
1 35 70 53
5 5 98 54
1 25 98 62
Only if Jim is 32 would there be ambiguity when Jim is told the sum of the ages.
In order for the ambiguity to be resolved by there being a passenger older than Bob,
the passenger's ages would have to be 7, 7 and 50, with Bob's age being 49.
From Giant Book of Mensa Mind Challenges, by Todd Johnson,
"Nearly Impossible Brain Bafflers" chapter, page 191. |