We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f2506c commit 294bc61Copy full SHA for 294bc61
euler/prob003-gerdr-cheating.pl
euler/prob003-gerdr.pl
@@ -1,14 +1,11 @@
1
use v6;
2
3
sub largest-prime-factor($n is copy) {
4
- my @primes;
5
for 2, 3, *+2 ... * {
6
- next if $_ %% any @primes.grep(->$p { $p * $p <= $_ or last });
7
- @primes.push($_);
8
while $n %% $_ {
9
- $n div= $_
+ $n div= $_;
+ return $_ if $_ > $n;
10
}
11
- return $_ if $_ > $n;
12
13
14
0 commit comments