/* Unpredictable prediction in Picat. From Chris Smith's Maths Newsletter #547 """ I gave Heidi, Logan, and Daisy a whole number I was thinking of ... [ Heidi: I'm multiplying your number by 4 or 5 Logan: I'll add 4 or 5 to that new number Daisy: I'll subtract 4 or 5 from Logan's number. ] Daisy told me that the final answer to their unpreditable calculation was 173. What number did I given then to start off with? """ Chris Smith's Twitter feed: https://twitter.com/aap03102 This model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import v3_utils. % import util. import cp. main => go. go ?=> LD = [X,H,L,D], LD:: 0..200, H #= X * 4 #\/ H #= X * 5, L #= H + 4 #\/ L #= H + 5, D #= L - 4 #\/ D #= L -5, D #= 173, solve(LD), println(ld=LD), println(x=X), fail, nl. go => true.