In a puzzle book I found the following puzzle:
The caption is in Dutch, but I can shortly describe it:
- There is a sequence of numbers in the range 0...6, which is not given
- There are 6 mathematical statements (listed below) that are true
- By using logic and crossing off certain numbers that you know are certainly not it, whomever plays the puzzle can find the sequence of numbers (the code).
For example, in the pictured case, we know that A+C=5
, thus we can infer that both A and C can not be 6. By doing these repeatedly, you will find the sequence.
Now, my question is: How could I write an algorithm that generates these puzzle values? I've tried to come up with a random sequence, and describe it with 6 similar mathematical statements, but in some cases the puzzle will be unsolvable.
Such an unsolvable case / statements are for example when the sequence is 012345, with statements A+B=1
B+C=3
C+D=5
D+E=7
E+F=9
F+A=5