Jump to content

Factors of an integer: Difference between revisions

→‎fac.m: Corrected a problem where the code would duplicate factors if they're perfect square roots.
(→‎fac.m: Corrected a problem where the code would duplicate factors if they're perfect square roots.)
Line 1,352:
factor(N, X, Z, LC, L) :-
(X > Z ->
L = list.sortsort_and_remove_dups(LC)
;
(0 = N mod X ->
Line 1,389:
 
<pre><nowiki>$ mmc fac.m && ./fac 100 999 12345678 booger
factor(100, [1,2,4,5,10,10,20,25,50,100])
factor(100) = [1,2,4,5,10,10,20,25,50,100]
factor(999, [1,3,9,27,37,111,333,999])
factor(999) = [1,3,9,27,37,111,333,999]
Cookies help us deliver our services. By using our services, you agree to our use of cookies.