Without actually running it, looks infinite recursion as last predicate is same as lhs of the rule Put another variable there, same variable can not unify with two values (forget assignment same varible name means exactly same value in Prolog) actually thinking about it the last statement is junk, remove it. Only add ground rule when Y <= M

Hello thanks for your reply.

Do you mean something like this:

```
checkNum(Num1, Num2) :-
Num1 > Num2.
modulo(A, B, Result) :-
Result is (A-B),
checkNum(Result, B),
```

?

BEGIN

Result = A-B,

check to see if the result is more than be,

[CONFUSED WHAT TO DO HERE]

END

I think you have to put result back modulo, because it takes 5 from the result..

Earn rewards points for helping others. Gain kudos. Cash out. Get better answers yourself.

It's as simple as contributing editorial or replying to discussions labeled OP Sponsor or OP Kudos