Jump to content

Perfect numbers: Difference between revisions

m
Fix section headers in Perl entry
m (→‎Lucas-Lehmer + other optimizations: added a comment for the "Lucus'" numbers.)
m (Fix section headers in Perl entry)
Line 1,174:
 
=={{header|Perl}}==
=== Functions ===
<lang perl>sub perf {
my $n = shift;
Line 1,192:
$n == sum(0, grep {$n % $_ == 0} 1..$n-1);
}</lang>
=== Modules ===
The functions above are terribly slow. As usual, this is easier and faster with modules. Both ntheory and Math::Pari have useful functions for this.
{{libheader|ntheory}}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.