/* Hardy's 1729 problem in Picat. From Hardy "A Mathematician's Apology" """ I had ridden in taxi cab 1729 and remarked that the number seemed to be rather a dull one. I hoped it was not an unfavorable omen. "No", he replied, "it is a very integresting number: it is the smallest number expressed as the sum of two cubes in two different ways. """ Solution: X1: 1 X2: 12 Y1: 9 Y2: 10 Z: 1729 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 ?=> L = [X1,X2,Y1,Y2,Z], L :: 0..10000, X1 #<= X2, Y1 #<= Y2, % symmetry breaking X1 #!= Y1, X1 #!= Y2, X1*X1*X1 + X2*X2*X2 #= Z, Y1*Y1*Y1 + Y2*Y2*Y2 #= Z, % symmetry breaking X1 #<= Y1, solve($[inout],L), println(L), fail, nl. go => true.