Skip to content

Sunday Times Teaser 2662 – Number Please

by Angela Newing

After getting through to a company on the phone, the operator tried the extensions 1933, 2829, 3133, 4630, 5089, 5705, 6358 and 6542, each of which had at least one correct digit of the correct extension in the correct position.

What was the correct extension number?

5 Comments Leave one →
  1. brian gladman permalink

  2. tonysmith permalink

    Hi Brian

    Does your program prove uniqueness? What would have happened if the set of tried numbers had given more than one extension meeting the condition?

    I suspect that your earlier program which I saw did not prove uniqueness but as a non-prgrammer I was not sure.

  3. brian gladman permalink

    Hi Tony,

    It rather depends on what you mean by ‘prove’! All possible correct extensions are tried and only one is shown to meet the condition spelt out in the teaser.

    Maybe you are uncertain about what the ‘break’ on line 17 does? The inner loop tries the extensions in turn but the ‘break’ terminates this loop as soon as a number is found in which no digts in the same positions match. This ‘break’ would continue to line 21 if there was one but, as there isn’t, it simply continues with the next value from line 10. If the inner loop completes with no break then the else on line 18 is used and the value is printed out before going on to the next number from line 11.

    The only difference between the program above and my earlier one is that the latter tried all numbers from 1000 to 9999 whereas the one above works out which digits can occur in each of the four positions and tries only numbers that use these. This cuts the search from 9000 numbers down to less than 2000.

  4. First, a short program to find solutions to the puzzle using all the extensions:

    Here is a more extensive search for unique solutions for subsets of the list of extensions:

  5. Here’s a recursive solution.

Leave a comment to Jim Randell Cancel reply

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

Subscribe to this comment feed via RSS