Enigmatic Code

Programming Enigma Puzzles

Puzzle 82: A cross number

From New Scientist #1133, 14th December 1978 [link]

puzzle-82

(There are no 0’s).

Across:

1. Each digit is odd and is greater than the one before.
4. The digits are all different and this is a multiple of the number which is 3 greater than 1 down. Even when reversed.
5. A perfect cube.

Down:

1. 17 goes into this.
2. A multiple of 1 down.
3. Each digit is odd and is less than the one before.

One clue is incorrect. Which one?

With which digit should each square be filled?

[puzzle82]

Advertisements

One response to “Puzzle 82: A cross number

  1. Jim Randell 1 February 2017 at 7:31 am

    This puzzle is similar to Puzzle 84, except that one of the clues given is wrong.

    I wrote code to solve puzzles using the SubstitutedExpression() solver from the enigma.py library with each one of the clues from the puzzle text deleted in turn.

    This Python program runs in 71ms.

    #
    # consider the grid:
    #
    #   A B C
    #   D E F
    #   # G H
    #
    
    from enigma import SubstitutedExpression, irange, flatten, printf
    
    # conditions for each clue
    clues = {
      # ABC = 1 across
      '1 across': [
        # "each digit is odd..."
        "A % 2 = 1", "B % 2 = 1", "C % 2 = 1",
        # "and is greater than the one before"
        "B > A", "C > B",
      ],
      # DEF = 4 across
      '4 across': [
        # "the digits are all different"
        "is_pairwise_distinct(D, E, F)",
        # "and this is a multiple of the number 3 greater than 1 down"
        "DEF % (AD + 3) = 0",
      ],
      # GH = 5 across
      '5 across': [
        # "a perfect cube"
        "is_cube(GH)",
      ],
      # AD = 1 down
      '1 down': [
        # "17 goes into this"
        "AD % 17 = 0",
      ],
      # BEG = 2 down
      '2 down': [
        # "a multiple of 1 down"
        "BEG % AD = 0",
      ],
      # CFH = 3 down
      '3 down': [
        # "each digit is odd"
        "C % 2 = 1", "F % 2 = 1", "H % 2 = 1",
        # "and is less than the one before"
        "F < C" , "H < F",
      ],
    }
    
    # make a puzzle missing out one of the clues
    for wrong in ['none'] + list(clues.keys()):
    
      # construct the list of expressions
      exprs = flatten(vs for (k, vs) in clues.items() if k != wrong)
    
      # make the puzzle from the expressions
      # - generally the digits don't have to be distinct
      # - only digits 1-9 are used
      p = SubstitutedExpression(exprs, distinct="", digits=irange(1, 9))
    
      # solve the puzzle
      for s in p.solve():
        # output the solution
        (A, B, C, D, E, F, G, H) = (s[x] for x in 'ABCDEFGH')
        printf("wrong = {wrong} [ {A}{B}{C} / {D}{E}{F} / _{G}{H} ]")
    

    Solution: The clue for 3 down is incorrect. The completed puzzle is shown below:

    puzzle-82-solution
    The clue for 3 down is only “half-wrong” in the sense that the digits are indeed all odd, but if is not the case that each one is less than the preceding digit.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: