Enigmatic Code

Programming Enigma Puzzles

Puzzle 2: Two, three, four, six

From New Scientist #1052, 26th May 1977 [link]

In this long division sum, I fear,
Most of the figures simply are not there.
Two and Three and Four and Six,
One of these is wrong. But which?
Three and Six and Four and Two,
Do you think that’s much too few?
Why don’t I give you rather more,
Than Six and Two and Three and Four?
To give you four, you will agree,
Is better than to give you three.
Look at the pattern if you wish.
All the figures look like this:

Puzzle 2

Which figure was wrong? Find the correct division sum.

News

This completes the Puzzle series of puzzles that were originally published in New Scientist between May 1977 (when Tantalizer finished) and February 1979 (when Enigma started).

There is now a complete archive of puzzles from July 1975 up to December 1989, and from March 1998 to December 2013 (when Enigma finished). Making a grand total of around 1542 puzzles on the site (plus a few extra) – about 30 years worth!

I will continue posting Enigma puzzles on Monday and Friday, and Tantalizer puzzles on Wednesday.

[puzzle2]

2 responses to “Puzzle 2: Two, three, four, six

  1. Jim Randell 18 March 2020 at 7:59 am

    We can use the [[ SubstitutedDivision() ]] solver from the enigma.py library to solve this puzzle.

    The following run file executes in 145ms.

    Run: [ @repl.it ]

    #!/usr/bin/env python -m enigma -r
    
    # writing the long division sum as:
    #
    #          ? B
    #      -------
    #  ? A ) ? ? ?
    #        ? ?
    #        ---
    #        ? C ?
    #        ? ? D
    #        =====
    
    SubstitutedDivision
    
    --distinct=""
    
    "??? / ?A = ?B"
    
    "?? - ?? = ?C"
    "?C? - ??D = 0"
    
    # exactly one of the following inequalities holds
    --extra="sum([A != 6, B != 4, C != 2, D != 3]) = 1"
    

    Solution: The given 3 digit is wrong (it should be 4). The correct sum is: 784 ÷ 56 = 14.

  2. GeoffR 18 March 2020 at 11:01 am
    % A Solution in MiniZinc
    include "globals.mzn";
    
    %         n B        1 4
    %      ------      ----
    %   a A)b c d   56)7 8 4
    %       e f        5 6 
    %       ---        ---
    %       g C i      2 2 4
    %       j k D      2 2 4
    %       =====      =====
    
    var 1..9:A; var 1..9:B; var 1..9:C; var 1..9:D;
    
    % One of four digits is incorrect
    constraint (A != 6 /\ (B==4 /\ C==2 /\ D==3))
    \/ (B != 4 /\ (A ==6 /\ C==2 /\ D==3))
    \/ (C != 2 /\ (A ==6 /\ B==4 /\ D==3))
    \/ (D != 3 /\ (A ==6 /\ B==4 /\ C==2));  
    
    var 1..9:a; var 1..9:n; var 1..9:b;
    var 0..9:c; var 1..9:d; var 1..9:e;
    var 0..9:f; var 1..9:g; var 1..9:i;
    var 1..9:j; var 0..9:k; 
    
    var 10..99: nB = 10*n + B;
    var 10..99: aA = 10*a + A;
    var 10..99: ef = 10*e + f;
    var 10..99: bc = 10*b + c;
    var 10..99: gC = 10*g + C;
    
    var 100..999: bcd = 100*b + 10*c + d;
    var 100..999: gCi = 100*g + 10*C + i;
    var 100..999: jkD = 100*j + 10*k + D;
    
    constraint aA * nB == bcd;
    constraint n * aA = ef /\ bc - ef == gC;
    constraint B * aA = jkD /\ gCi - jkD == 0;
    
    solve satisfy;
    
    output [ "Sum is " ++show(bcd) ++ " / " ++ show(aA) ++ " = " 
    ++ show(nB) ++ "\n" ++ "[A,B,C,D] = " ++ show([A,B,C,D])];
    
    % Sum is 784 / 56 = 14
    % [A,B,C,D] = [6, 4, 2, 4] - so 'D' was wrong
    % time elapsed: 0.03 s
    % ----------
    % ==========
    
    
    
    

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: