Proper divisors: Difference between revisions
Content added Content deleted
Line 883: | Line 883: | ||
10 1 2 5 |
10 1 2 5 |
||
max = 79, candidates = 15120 18480</pre> |
max = 79, candidates = 15120 18480</pre> |
||
=={{header|Phix}}== |
|||
<lang Phix>for i=1 to 10 do |
|||
?{i,factors(i,-1)} |
|||
end for |
|||
integer maxd = 0, k |
|||
sequence candidates = {} |
|||
for i=1 to 20000 do |
|||
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:", maxd) |
|||
?candidates |
|||
{} = wait_key()</lang> |
|||
{{out}} |
|||
<pre> |
|||
{1,{}} |
|||
{2,{1}} |
|||
{3,{1}} |
|||
{4,{1,2}} |
|||
{5,{1}} |
|||
{6,{1,2,3}} |
|||
{7,{1}} |
|||
{8,{1,2,4}} |
|||
{9,{1,3}} |
|||
{10,{1,2,5}} |
|||
79 divisors:{15120,18480} |
|||
</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |