The puzzle is:
Place each number from 1 through 10 in a box. Each box must contain a number that is the difference of two boxes above it, if there are two above it.
The ten boxes are positioned in an inverted triangle with side 4.
My question is: is there an easy way to solve the problem? (as opposed to guessing the solution by a systematic search).
My approach was: 10 is obviously in the top row, so WLOG it is either in the corner or in the second position (the problem is symmetric). 9 is either in the top row or under 10. &c &c &c - until I arrived at
9 10 3 8
1 7 5
6 2
4
Another solution is (mathforum & answers):
8 10 3 9
2 7 6
5 1
4
and mathforum wrongly claims that these two (+ 2 symmetric) are the only ones.
Brute search (using CLOCC/CLLIB/math.lisp):
(defun triangle-is-good (tr)
(and (= (abs (- (aref tr 0) (aref tr 1))) (aref tr 4))
(= (abs (- (aref tr 1) (aref tr 2))) (aref tr 5))
(= (abs (- (aref tr 2) (aref tr 3))) (aref tr 6))
(= (abs (- (aref tr 4) (aref tr 5))) (aref tr 7))
(= (abs (- (aref tr 5) (aref tr 6))) (aref tr 8))
(= (abs (- (aref tr 7) (aref tr 8))) (aref tr 9))))
(with-collect (co)
(with-permutations-shuffle (tr (vector 1 2 3 4 5 6 7 8 9 10))
(when (triangle-is-good tr)
(co (copy-seq tr)))))
yields two more (for a total of 8) solutions:
6 10 1 8
4 9 7
5 2
3
and
8 10 1 6
2 9 5
7 4
3
The only common features across all four solution I see are:
- the position of 10
- 8 is in a top corner
- the sum of the "top inner triangle" is 20
[[6, 1, 10, 8], [5, 9, 2], [4, 7], [3]]and[[6, 10, 1, 8], [4, 9, 7], [5, 2], [3]]– cardboard_box Apr 06 '16 at 20:49