Proper divisors: Difference between revisions

m
→‎{{header|Phix}}: factors() now allows 0
m (→‎{{header|Phix}}: factors() now allows 0)
Line 3,866:
return lfactors & hfactors
end function</lang>
The compiler knows where to find that, but note the above does not permit 0, so the main program is just:
<lang Phix>functionfor proper_divisors(integeri=0 n)to 10 do
printf(1,"%d: %v\n",{i,proper_divisorsfactors(i,-1)})
if n=0 then return {} end if
return factors(n,-1) -- (-1 means "1 but not n")
end function
 
for i=0 to 10 do
printf(1,"%d: %v\n",{i,proper_divisors(i)})
end for
 
7,820

edits