# Enigmatic Code

Programming Enigma Puzzles

## Puzzle 10: A cross number

From New Scientist #1061, 21st July 1977 [link]

(There are no 0’s)

Across:

1. Half of 2 down.
3. Each digit is 2 greater than the one before.
4. The sum of the digits is at least 3 greater than the sum if the digits of 1 across.

Down:

1. The 1st digit is greater than the 2nd digit by the same amount as the 2nd digit is greater than the 3rd digit.
2. Twice 1 across.
3. An odd number

[puzzle10]

### 2 responses to “Puzzle 10: A cross number”

1. Jim Randell 13 November 2019 at 9:27 am

We can solve this puzzle using the [[ `SubstitutedExpression()` ]] solver from the enigma.py library.

The following run file executes in 135ms.

Run: [ @repl.it ]

```#!/usr/bin/env python -m enigma -r

#  # A B
#  C D E
#  F G H

SubstitutedExpression

--digits="1-9"
--distinct=""

# 1a. "Half of 2 down" / 2d. "Twice 1 across"
"2 * AB = BEH"

# 3a. "Each digit is 2 greater than the one before"
"C + 2 = D" "D + 2 = E"

# 4a. "The sum of the digits is at least 3 greater than the sum of the
# digits of 1 across"
"(F + G + H) - (A + B) > 2"

# 1d. "The first digit is greater than the second digit by the same
# amount as the 2nd digit is greater than the 3rd digit"
"D - G == A - D"

# 3d. "An odd number"
--invalid="2|4|6|8,F"
```

Solution: The completed puzzle is shown below:

2. GeoffR 13 November 2019 at 4:36 pm
```% A Solution in MiniZinc
include "globals.mzn";
%   # A B
%   C D E
%   F G H

var 1..9: A; var 1..9: B; var 1..9: C;
var 1..9: D; var 1..9: E; var 1..9: F;
var 1..9: G; var 1..9: H;

var 10..99: AB = 10*A + B;
var 10..99: CF = 10*C + F;
var 100..999: BEH = 100*B + 10*E + H;

constraint 2 * AB == BEH     % 1 across
/\ D == C + 2 /\  E == D + 2 % 3 across
/\ (F + G + H) - (A + B) > 2 % 4 across
/\  D - G == A - D   % 1 down
% 2 down - see 1 across
/\ CF mod 2 == 1;    % 3 down

solve satisfy;

output [ " #" ++ show(AB)
++"\n " ++ show(C),show(D),show(E)
++"\n " ++ show(F),show(G),show(H) ];

% #91
% 468
% 932

```

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