Hi,
I need to write a rule to find all the factors of a given number, this is that i have so far:
% "divisible without remainder function"
dwr(X, M) :- 0 is X mod M.
factors_of(X):-
D is 1,
findfactors(X, D).
findfactors(X, D):-
D = X,
F is X / D,
write(F).
findfactors(X, D):-
D < X...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.