Abundant odd numbers: Difference between revisions

m
→‎{{header|AppleScript}}: Minor improvement to handler.
(Solution in q)
m (→‎{{header|AppleScript}}: Minor improvement to handler.)
Line 353:
 
<lang applescript>on aliquotSum(n)
set sum toif (n >< 12) asthen return integer0
ifset (nsum >to 1) then
set sqrt to n ^ 0.5
repeat with i iffrom (sqrt moddiv 1) isto 0)2 thenby -1
if (n mod i is 0) then set sum to sum + sqrti + n asdiv integeri
end repeat
set sqrt to sqrt - 1
if (nsqrt mod i1.0 is 0.0) then set sum to sum + i +- nsqrt div i1
end if
repeat with i from (sqrt div 1) to 2 by -1
if (n mod i is 0) then set sum to sum + i + n div i
end repeat
end if
return sum
557

edits