Factors of an integer: Difference between revisions

Content added Content deleted
m (→‎{{header|AppleScript}}: Straightforward version: minor change.)
Line 626:
set sqrt to n ^ 0.5
ifset limit to (sqrt moddiv 1 is 0) then
if (limit set end of output to= sqrt) as integerthen
set sqrtend toof sqrtoutput -to 1limit
set limit to limit - 1
end if
repeat with i from (sqrt div 1)limit to 1 by -1
if (n mod i is 0) then
set beginning of output to i