Skip to content

Sunday Times Brain-Teaser 904 – The Six Ages

by Brian Gladman on January 25, 2022

by Victor Bryant

From The Sunday Times, 18th November 1979 (link)

Problems concerning ages have always proved fruitful and entertaining exercises to both mathematicians and non-mathematicians. Trial and error methods, calculators and normal or esoteric mathematical techniques can all be deployed to find the correct solution. The most elegant or the most economical method is naturally the most commendable, but the correct solution, however obtained, is the desideratum.

Our problem concerns six men whose ages are within the range 21 to 89 and any two of them differ by at least 9. If we take the two digits comprising each of the ages of three of the men, and reverse them, we obtain the ages of the other three men.

What is more, if we take the sum of the ages of the first group, we find that it equals the sum of the ages of the second group of three.

Also the sum of the squares of the three ages of the first group equals the sum of the squares of the ages of the second group of three.

Finally, one of the ages in each group is exactly twice an age in the other group.

What are the ages of the six men (in increasing order)?

From → Uncategorized

9 Comments Leave one →
  1. Brian Gladman permalink

    This teaser is interesting since, as it hints, there are many different ways of approaching it.

    Here is my first attempt which runs in 25 milliseconds.

    It soon occurred to me that there can be only one age in each decade and this led to this solution:

    which runs in 15 milliseconds.

    A third option is to use a constraint programming approach using MiniZinc accessed using Jim Randell’s >minizinc wrapper:

    However, this does not compete on speed, running in 250 milliseconds.

  2. John Z permalink

  3. John Z permalink

    Another solution using recursion. I’m not sure if this is any faster than the above solutions

  4. John Z permalink

    Final shot!

  5. John Z permalink

    Never say ‘never’ or ‘final shot’ for that matter

    I’m not entirely satisfied with my method of generating three non-overlapping pairs of digits which has an efficiency of about 1/30. I couldn’t come up with a ‘manual’ but not empirical method before patience ran out.

    • Brian Gladman permalink

      Hi John,

      Wow, four different versions! This one beats your previous speed record and is down to 2 milliseconds on my PC.

      I am certainly not sure my own patience would have lasted this long!

  6. John Z permalink

    Well, here’s a fifth with every milligram of fat sweated out.

    • Brian Gladman permalink

      Hi John,

      Congratulations, it certainly holds the speed record – it is too fast to register on profile, which I normally use for ad hoc timing. I also noticed your earlier neat trick for reversing the two digits when you make two digit values. And we now have eight different versions in total.

  7. John Z permalink

    Line 31 of my code would be more readable if it were

    But this is less concise; has more keystrokes.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS