Skip to content

Commit

Permalink
[euler] finish partially complete implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
paultcochrane committed Apr 22, 2015
1 parent 65086c1 commit aabe746
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions categories/euler/prob003-hexmode.pl
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@
}
}

my $p = Prime.new;
my @q = gather { take $p.next for (0..10) };
my @r;
my $number = 600851475143;

my $prime = Prime.new;
my $current-prime;
my @primes = gather repeat {
$current-prime = $prime.next;
if $number %% $current-prime {
take $current-prime;
$number /= $current-prime;
}
} while ($current-prime < $number);

for (0..10) {
push @r, $p.next;
}
say @q.join(",");
say @r.join(",");
say @primes.max;

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit aabe746

Please sign in to comment.