Factors of an integer: Difference between revisions

m
→‎optimized version: changed (comment): divisors to integers. -- ~~~~
mNo edit summary
m (→‎optimized version: changed (comment): divisors to integers. -- ~~~~)
Line 1,798:
divisors: procedure; parse arg x 1 b; if x==1 then return 1; a=1; odd=x//2
/*Odd? Then use only odd divisors*/
do j=2+odd by 1+odd while j*j<x /*divide by all divisorsintegers up to √x*/
if x//j\==0 then iterate /*¬ divisible? Then keep looking*/
a=a j; b=x%j b /*add a divisor to both lists. */