Factors of an integer: Difference between revisions
Content added Content deleted
(→fac.m) |
(→fac.m) |
||
Line 1,329: | Line 1,329: | ||
list.sort_and_remove_dups([1, N | Unsorted], Factors). |
list.sort_and_remove_dups([1, N | Unsorted], Factors). |
||
:- pred factor(int |
:- pred factor(int, int, int, list(int), list(int)). |
||
:- mode factor(in, in, in, in, out) is det. |
|||
factor(N, X, Limit, !Accumulator) :- |
factor(N, X, Limit, !Accumulator) :- |
||
( if X > Limit |
( if X > Limit |
||
Line 1,342: | Line 1,343: | ||
factor(N) = Factors :- factor(N, Factors). |
factor(N) = Factors :- factor(N, Factors). |
||
:- end_module fac. |
:- end_module fac.</lang> |
||
</lang> |
|||
===Use and output=== |
===Use and output=== |