% % Maths challenge 2004-2005 J5 % % % 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 % % What are the values of a, b, c, and d? % var 0..9: a; var 0..9: b; var 0..9: c; var 0..9: d; % all digits are different (there are at least two more ways of doing this) constraint a != b /\ a != c /\ a != d /\ b != c /\ b != d /\ c != d; % the two digit number cd is 3 times the two digit number ab constraint 10*c + d = 3*(10*a + b); % The two digit number da is 2 times the two digit number bc constraint 10*d + a = 2*(10*b + c); solve satisfy;