Jump to content

Factors of an integer: Difference between revisions

Line 1,329:
list.sort_and_remove_dups([1, N | Unsorted], Factors).
:- pred factor(int::in, int::in, int::in, list(int)::in, list(int)::out) is det.
:- mode factor(in, in, in, in, out) is det.
factor(N, X, Limit, !Accumulator) :-
( if X > Limit
Line 1,342 ⟶ 1,343:
factor(N) = Factors :- factor(N, Factors).
 
:- end_module fac.</lang>
</lang>
 
===Use and output===
Cookies help us deliver our services. By using our services, you agree to our use of cookies.