The Puzzles


Order the Ages

You might encounter elimination puzzles like this one in Mensa-style books. As mental calisthenics, they have a lot to recommend them.

Andrew, Carol, Jessica, Luke, and Tommy are sitting around a circular table. Carol is 12 years older than her neighbor to the left. Tommy is five years older than his neighbor to the right. Jessica is 14 years older than her neighbor to the left. Luke is five years younger than his neighbor to the left. By age, from youngest to oldest, they are ordered as follows: Luke, Tommy, Andrew, Jessica, and Carol. Luke is 16 and Carol is 40. The total of the ages is 135. In which order are the people sitting (starting with Tommy and then proceeding in clockwise order) and what are their ages? First try to do this on your own; when you’ve solved it or are ready for help, read on.

Start with the most specific facts: Luke is 16 and Carol is 40, totaling 56. This implies that the ages of Tommy, Andrew, and Jessica add up to 79 (135 - 56 = 79). Further, we know that Tommy and Luke are neighbors because Luke’s left neighbor is 21, so if that’s not Tommy, then both Tommy and Luke’s left neighbors are 21 or less (because Tommy is second youngest after Luke). This leaves 79 - 42 = 37 left for the last person. But Carol is 12 years older than her neighbor to the left, so someone must be 28 years old. Hence, in clockwise order we must have Tommy, then Luke. This means that Tommy, Luke, and Carol total 21 + 16 + 40 = 77.

Therefore, Jessica and Andrew total 135 - 77 = 58. Because Jessica is known to be older than Andrew and the person to the left of Carol must be 28 years old, Andrew is 28 and Jessica is 30.

The ages then lend insight to the seating. Ordering Tommy, Luke, and then Carol is impossible because Carol is 40. This implies that Carol’s left neighbor is Andrew, since we know he is 28.

This leaves two possibilities:

  • Tommy, Luke, Jessica, Andrew, Carol

  • Tommy, Luke, Andrew, Carol, Jessica

But in fact only the first one is possible because Jessica is 14 years older than her neighbor to the left. That can only be Luke. So we conclude:

  • Tommy(21), Luke (16), Jessica (30), Andrew (28), Carol(40)

What would you do if you wanted to solve many puzzles like this in a short time? When the numbers are this small, I suggest laying out all orders and then filling in numbers starting with the ones you know to see if they work. In this case, once you arrived at the correct ordering, you would have started with

  • Tommy, Luke (16), Jessica, Andrew, Carol (40)

and then filled in the other numbers based on constraints:

  • Tommy (21), Luke (16), Jessica (30), Andrew (28), Carol (40)

When the number of orders is too large, this can’t be done, of course. In that case, you would need to determine local orderings (as we did for Tommy and Luke) and then order the rest.

The point, however, is that the following simple algorithm works really nicely for many puzzles:

 for each ordering R  try to verify constraints  reject R if some constraint fails end for

Replacing difficult analysis by a program that tries lots of possibilities without much human tinkering is a recurrent theme in this chapter. Purists may object that having the computer race through many choices mindlessly is a travesty of thought. My first reaction: So be it. My second: Thought will return soon enough in the form of a better algorithmic approach when the number of cases explodes.




Puzzles for Programmers and Pros
Puzzles for Programmers and Pros
ISBN: 0470121688
EAN: 2147483647
Year: 2007
Pages: 81
Authors: Dennis Shasha

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net