Jump to content

Abundant, deficient and perfect number classifications: Difference between revisions

Line 962:
 
=={{header|Phix}}==
<lang Phix>integer deficient=0, perfect=0, abundant=0, N
<lang Phix>
for i=1 to 20000 do
</lang>
N = sum(factors(i))+(i!=1)
if N=i then
perfect += 1
elsif N<i then
deficient += 1
else
abundant += 1
end if
end for
printf(1,"deficient:%d, perfect:%d, abundant:%d\n",{deficient, perfect, abundant})</lang>
{{out}}
<pre>
deficient:15043, perfect:4, abundant:4953
</pre>
 
7,830

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.