Factors of an integer: Difference between revisions
→{{header|AppleScript}}
Line 273:
-- Factors up to square root of n,
set lows to filter(mClosure(isFactor of mf, {n:n}), range(1, intRoot))
log lows
-- and quotients of these factors beyond the square root
set highs to map(mClosure(integerQuotient of mf, {n:n}), lows)
log highs
-- For perfect squares, no need to consider the head of the 'highs' list
if realRoot = intRoot then
lows &
else
lows & reverse of highs
Line 287 ⟶ 288:
on run
integerFactors(
end run
|