Jump to content

Factors of an integer: Difference between revisions

Line 700:
 
=={{header|Ursala}}==
The simple way:
Filter the sequence of numbers from 1 to n according to divisibility into n.
<lang Ursala>#import std
#import nat
 
factors "n" = (filter not remainder/"n") nrange(1,"n")</lang>
The complicated way:
<lang Ursala>factors "n" = nleq-<&@s <.~&r,quotient>*= "n"-* (not remainder/"n")*~ nrange(1,root("n",2))</lang>
test program:
<lang Ursala>#cast %nL
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.