Enigmatic Code

Programming Enigma Puzzles

Tantalizer 424: Directory enquiry

From New Scientist #975, 13th November 1975 [link]

Mr Meek is pleased with his new phone number, because it has four digits, the middle two of which are identical. “Like my name”, he explains. The repeated digit is also the first digit of Mr Humble’s new four digit number. Moreover Mr Meeks first digit is the same as the first digit of Mr Lowly’s new four digit number.

If you interchange the first and last digits of Mr Lowly’s number, you get Mr Humble’s. If you subtract Mr Lowly’s number from Mr Humble’s, you get Mr Meek’s.

So what is Mr Meek’s new number?


3 responses to “Tantalizer 424: Directory enquiry

  1. Jim Randell 24 July 2019 at 9:36 am

    The phone numbers are:

    Meek = MEEK
    Humble = EXYM
    Lowly = MXYE


    Humble – Lowly = Meek
    999(EM) = MEEK

    We can plug this into the [[ SubstitutedExpression() ]] solver from the enigma.py library:

    Run: [ @repl.it ]

    % python -m enigma SubstitutedExpression -i "999 * (E - M) = MEEK"
    (999 * (E - M) = MEEK)
    (999 * (9 - 4) = 4995) / E=9 K=5 M=4
    [1 solution]

    Solution: Mr Meek’s new phone number is 4995.

    The alphametic can be further simplified to:

    889E = 1999M + K

    Which can be solved manually, or we can use a simple Python program:

    from enigma import irange, printf
    for E in irange(1, 9):
      (M, K) = divmod(889 * E, 1999)
      if K > 9 or len(set([E, M, K])) < 3: continue
      printf("MEEK = {M}{E}{E}{K}")
  2. GeoffR 25 July 2019 at 6:31 pm
    % A Solution in MiniZinc
    include "globals.mzn";
    var 1..9: M; var 1..9: E; var 1..9: K;
    var 1..9: X; var 1..9: Y;
    constraint all_different ([M, E, K, X, Y]);
    var 1000..9999: MEEK = 1000*M + 100*E + 10*E + K;  % Mr Meek
    var 1000..9999: MXYE = 1000*M + 100*X + 10*Y + E;  % Mr Lowly
    var 1000..9999: EXYM = 1000*E + 100*X + 10*Y + M;  % Mr Humble
    % subtract Mr Lowly’s number from Mr Humble’s to get Mr Meek’s.
    constraint EXYM - MXYE == MEEK;
    solve satisfy;
    output ["Mr MEEK's number is " ++ show(MEEK) ];
    % Mr MEEK's number is 4995
    % ----------
    % ==========  means a single solution

    Although there is only 1 solution for Mr Meek’ s telephone number, I wondered how many solutions there were for Mr Lowly and Mr Humble’s telephone numbers.

    The single solution for Mr MEEK uses the digits 4,5 and 9, whilst the other two telephone numbers use digits E and M ie 4 and 9. This leaves possible digits 1,2,3,6,7,8 for X and Y. Digit X can be any one digit from 6 digits, leaving 5 digits for digit Y, so a total of 6 * 5 = 30 values for X and Y.

    Setting MiniZinc for multiple configuration output (with Mr Lowly and Mr Humble’s telephone numbers included). does confirm that there are 30 possible solutions for Mr Lowly and Mr Humble’s telephone numbers.

    • Jim Randell 25 July 2019 at 6:42 pm

      @GeoffR: X and Y are unconstrained so can take on any of the values of the remaining digits. Normally the digit 0 is allowed in telephone numbers, so there are P(10 – 3, 2) = 42 possible solutions, if X and Y are taken into account.

      % python -m enigma SubstitutedExpression -i "EXYM - MXYE = MEEK"
      [42 solutions]

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: