/* Bus problem in Picat. rec.puzzles FAQ http://brainyplanet.com/index.php/Bus?PHPSESSID=051ae1e2b6df794a5a08fc7b5ecf8028 """ Putting 33 students in each bus, the teacher has one student left over. Putting more in each bus, but always the same number in each bus, the teacher has one bus left over. How many buses and students are there? """ 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 ?=> M = 10000, N = 33, % A: students % B: number of buses % C: number of students per bus for the second try L = [A,B,C], L :: 1..M, (A-1) #= B * N, A #= C * (B-1), solve(L), println([students=A,buses=B,students_per_bus_2=C]), fail, nl. go => true.