/* Enigma puzzle #1615 in Picat. Via http://www.f1compiler.com/samples/Enigma%201615.f1.html """ Enigma 1615, Gwyn Owen, New Scientist magazine, 29 September 2010 ENIGMA represents a six-digit number in which the digits are all different and non-zero. When EN slides from the front to the back, the resulting six-digit number, IGMAEN, is 20 per cent larger than ENIGMA. What is ENIGMA? """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> X = [E,N,I,G,M,A], X :: 1..9, ENIGMA #= E*100000 + N*10000 + I*1000 + G*100 + M*10 + A, IGMAEN #= I*100000 + G*10000 + M*1000 + A*100 + E*10 + N, all_different(X), 10*IGMAEN #= 12*ENIGMA, solve(X), println(enigma=ENIGMA), println(igmaen=IGMAEN), nl, fail, nl. go => true.