/* Bank card code problem in Picat. From http://www.dcs.gla.ac.uk/~pat/cpM/JChoco/test/MathChallenge.java """ My bank card has a 4 digit pin, abcd. I use the following facts to help me remember it: - no two digits are the same - the 2-digit number cd is 3 times the 2-digit number ab - the 2-digit number da is 2 times the 2-digit number bc """ 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 = [A,B,C,D], X :: 0..9, all_different(X), (10*C+D) #= 3*(10*A+B), (10*D+A) #= 2*(10*B+C), solve(X), println(X), fail, nl. go => true.