/* Find the triangle in Picat. From Adrian Groza "Modelling Puzzles in First Order Logic" """ Puzzle 17. Find the triangle The sides and height of a triangle are four consecutive whole numbers. What is the area of the triangle? (puzzle 230 from Dudeney (2016)) """ Solution [h = 12,a = 13,b = 14,c = 15,area = 84] This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> % A, B, and C are the sides, S is the height X = [H,A,B,C,Area], X :: 1..100, A + 1 #= B, B + 1 #= C, H+1 #= A #\/ C + 1 #= H, 2*Area #= A*H #\/ 2*Area #= B*H #\/ 2*Area #= C*H, 2* P #= A+B+C, Area*Area #= P*(P-A)*(P-B)*(P-C), solve(X), println([h=H,a=A,b=B,c=C,area=Area]), fail, nl. go => true.