RosettaCodeData/Task/Proper-divisors/Phix/proper-divisors-2.phix
2026-02-01 16:33:20 -08:00

18 lines
386 B
Text

for i=0 to 10 do
printf(1,"%d: %v\n",{i,factors(i,-1)})
end for
sequence candidates = {}
integer maxd = 0
for i=1 to 20000 do
integer k = length(factors(i,-1))
if k>=maxd then
if k=maxd then
candidates &= i
else
candidates = {i}
maxd = k
end if
end if
end for
printf(1,"%d divisors: %v\n", {maxd,candidates})