 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Age Ascertainment (Posted on 2010-04-03) Three friends Alan, Ben and Cal, the age of each of whom is a positive integer number of years, made the following statements in response to a query posited by Don, who is a mutual acquaintance. (It is known to Don that the age of each of the three friends exceeds 20 years.)

Alan: "If you take the two digits of my age and subtract 62, the result is 9 less than Ben's age."

Ben: "If you reverse the two digits of my age and subtract 12, the result is Cal's age with the digits reversed."

Cal: "If you reverse the two digits of my age and add 47, the result is Alan's age with the digits reversed."

Don was unable to determine their ages, and requested for additional clarification, when Alan replied, "If I tell you whether my age is prime or composite, you will be able to determine our ages."

Thereupon, Don accurately deduced their ages.

Determine the age of each of the three friends in conformity with the abovementioned statements.

Note: Don is a logician and math wizard.

 See The Solution Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer solution | Comment 1 of 3

DEFDBL A-Z
CLS
FOR alan = 21 TO 99
ben = alan - 62 + 9
IF ben > 20 AND ben < 100 THEN
b1 = ben \ 10: b2 = ben MOD 10
c = b2 * 10 + b1 - 12
IF c > 9 AND c < 100 THEN
c1 = c \ 10: c2 = c MOD 10
cal = c1 + c2 * 10
IF cal > 20 AND cal < 100 THEN
a = c + 47
IF a < 100 THEN
a1 = a \ 10: a2 = a MOD 10
IF alan = a2 * 10 + a1 THEN
PRINT alan; ben; cal
END IF
END IF
END IF
END IF
END IF
NEXT

lists as possible values for Alan, Ben and Cal:

`Alan Ben Cal 95  42  21 96  43  22 97  44  23 98  45  24 99  46  25`
` `

Alan's age is prime only when their respective ages are 97, 44 and 23, and so these must be their ages, although it seems silly to refer to reversing the digits in Ben's age.

 Posted by Charlie on 2010-04-03 13:43:26 Please log in:

 Search: Search body:
Forums (0)