Abundant, deficient and perfect number classifications: Difference between revisions
Content added Content deleted
(added Easylang) |
Not a robot (talk | contribs) (add SETL) |
||
Line 5,237: | Line 5,237: | ||
Abundant: 4953 |
Abundant: 4953 |
||
</pre> |
</pre> |
||
=={{header|SETL}}== |
|||
<syntaxhighlight lang="setl">program classifications; |
|||
P := properdivisorsums(20000); |
|||
print("Deficient:", #[n : n in [1..#P] | P(n) < n]); |
|||
print(" Perfect:", #[n : n in [1..#P] | P(n) = n]); |
|||
print(" Abundant:", #[n : n in [1..#P] | P(n) > n]); |
|||
proc properdivisorsums(n); |
|||
p := [0]; |
|||
loop for i in [1..n] do |
|||
loop for j in [i*2, i*3..n] do |
|||
p(j) +:= i; |
|||
end loop; |
|||
end loop; |
|||
return p; |
|||
end proc; |
|||
end program;</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Deficient: 15043 |
|||
Perfect: 4 |
|||
Abundant: 4953</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |