Assigment for university

Hey everyone, I have a problem in solving this assignment for my Prolog class at the university, if anyone could help me I would be thankful :slight_smile:


Thanks in advance.

See accumulator version, which has best performance.

1 Like