Logic Programming

Assignment - Arithmetic

For each of the following problems, write a query to solve the problem. Values should include just the digits 8, 1, 4, 7, 3 and each digit should be used at most once in the solution of each puzzle. Your query should express the problem as stated, i.e. you should not first solve the problem yourself and then have the query simply return the answer.

(a) The product of a 1-digit number and a 2-digit number is 284.
(b) The product of two 2-digit numbers plus a 1-digit number is 3,355.
(c) The product of a 3-digit number and a 1-digit number minus a 1 digit number is 1,137.
(d) The product of a 2-digit number and a 3-digit number is between 13,000 and 14,000.
(e) When a 3-digit number is divided by a 2-digit number the result is between 4 and 6.