/* Octagon product in Picat. From Chris Smith Math Newsletter #592 """ Use the numbers 1-9 in the octagons so that the products of the octagons that touch each square give the total in the square! A B C 90 84 D E F 80 72 G H I [E = 1] """ This model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> L = [A,B,C,D,E,F,G,H,I], L :: 1..9, all_different(L), A*B*D*E #= 90, B*C*E*F #= 84, D*E*G*H #= 80, E*F*H*I #= 72, % E #= 1, % This is not needed solve(L), println(L), printf(" %d %d %d\n\n",A, B, C), printf(" %d %d\n\n", 90, 84), printf(" %d %d %d\n\n",D,E,F), printf(" %d %d\n\n",80,72), printf(" %d %d %d\n",G,H,I), nl, fail, nl. go => true.