/* Ages problem in Picat. From MindYourDecisions """ I was browsing an MIT admissions exam in 1876 and came across a fun little riddle. A father said to his son, “Two years ago I was three times as old as you; but in fourteen years I shall be only twice as old as you.” What were the ages of each? This is a routine question today. But it evidently was a challenging problem in 1876. """ Answer: * father = 50 * son = 18 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 ?=> Father :: 1..99, Son :: 1..99, % Two years ago I was three times as old as you; Father - 2 #= 3*(Son-2), % but in fourteen years I shall be only twice as old as you.” Father + 14 #= 2*(Son+14), solve([Father,Son]), println(father=Father), println(son=Son), nl, fail, nl. go => true.