Skip to content

Sunday Times Teaser 3053 – Endless Number

by BRG on March 26, 2021

by Danny Roth

Published Sunday March 28 2021 (link)

George and Martha have a telephone number consisting of nine digits; there is no zero and the others appear once each. The total of the digits is obviously 45, so that the number is divisible by nine. Martha noticed that, if she removed the last (ie, the least significant) digit, an eight-digit number would remain, divisible by eight. George added that you could continue this process, removing the least significant digit each time to be left with an n-digit number divisible by n right down to the end.

What is their telephone number?

From → Uncategorized

5 Comments Leave one →
  1. Brian Gladman permalink

  2. Erling Torkildsen permalink

    By trading shortcuts (from analysis) for a uniform routine, a recursive-like approach can be used:

  3. John Z permalink

    A straightforward solution:

    Another solution that doesn’t use the imported ‘permutations’ function
    but uses an ad hoc recursive function:

  4. John Z permalink

    Yes, this ship sailed many moons ago but I kept tweaking.
    This version is more computationally efficient but contains 2 additional lines of code to deal with the fifth digit which analysis shows must = 5 and separates the odd and even digits.
    ‘whatsleft’ is renamed ‘dr’

Leave a Reply

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

Subscribe to this comment feed via RSS