Perfect numbers: Difference between revisions

jq
(Add note about the minimum size of an odd perfect number. It's so large that most of the programs here can safely ignore them.)
(jq)
Line 819:
496
8128</pre>
 
=={{header|jq}}==
<lang jq>
def is_perfect:
. as $in
| $in == reduce range(1;$in) as $i
(0; if ($in % $i) == 0 then $i + . else . end);
 
# Example:
range(1;10001) | select( is_perfect )</lang>
{{Out}}
# jq -n -f is_perfect.jq
6
28
496
8128
 
=={{header|Julia}}==
2,482

edits