Sunday Times 2597 – Ages Ago
by H. Bradley and C. Higgins
Published: 1 July 2012 (link)
Bert’s age in years is one less than one-and-a-half times the age Alf was a whole number of years ago. Cal’s age in years is one less than one-and-a- half times the age Bert was, the same number of years ago. Dave’s age in years is one less than one-and-a-half times the age Cal was, again the same number of years ago. All four ages are different two-figure numbers, Cal’s age being Bert’s age with the order of the digits reversed.
What (in alphabetical order) are their ages?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617181920212223242526# start with B's two digit agefor B in range(10, 100):# C's (different) two digit age is B's digit reversedC = int(str(B)[::-1])if C < 10 or C == B:continue# calculate the number of years ago (p) from B and C# from C = 1.5(B - p) - 1p, r = divmod(3 * B - 2 * C - 2, 3)if r or p <= 0:continue# now calculate the two digit ages for A and DA, r = divmod(2 * B + 3 * p + 2, 3)if not r and 10 <= A < 100:D, r = divmod(3 * (C - p) - 2, 2)if not r and 10 <= D < 100:# ensure that all the ages are differentif len(set((A, B, C, D))) == 4:s = ' and '.join(str(x) for x in (A, B, C, D))s = s.replace(' and ', ', ', 2)print('The ages are {}.'.format(s))