title: Solving an arithmetic expression with multiple answers (Vietnamese Math Maze)
body: <p>I have to try and solve this Vietnamese math challenge (<a href="https://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/20/can-you-do-the-maths-puzzle-for-vietnamese-eight-year-olds-that-has-stumped-parents-and-teachers" rel="nofollow noreferrer">https://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/20/can-you-do-the-maths-puzzle-for-vietnamese-eight-year-olds-that-has-stumped-parents-and-teachers</a>) using prolog and I've been really stumped as to how to write the predicate. Here's the question: </p>
  
  <blockquote>
    <p>Assume ordinary rules of arithmetic precedence (i.e.
    multiplication/division before addition/subtraction). The answers
    should be in the form of a list of digits which would be entered into
    the blanks in the maze from left to right. Name the predicate mathmaze
    and have it take one argument, which gets instantiated as the correct
    list of numbers (and gives other answers when prompted with ;).</p>
  </blockquote>
  
  <p>This is what I have so far, but I have no idea how to actually how to have it try 1-9 in each position of the equation. </p>
  
  <pre><code>mathmaze([H|T]) :-
     A + ((13* B) / C) + D + (12 * E) - F - 11 + G * (H / I) - 10 = 66. 
  </code></pre>