Skip to content

Instantly share code, notes, and snippets.

@risou
Created January 20, 2012 07:51
Show Gist options
  • Save risou/1646043 to your computer and use it in GitHub Desktop.
Save risou/1646043 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
my $max = 0;
for (1..1000) -> $x {
for (1..1000) -> $y {
$max = 0;
for (1..1000) {
my @a;
my $n = (($x-1)*1000+($y-1))*1000+$_;
loop (my $i = 1; $i*$i <= $n; $i++) {
if $n % $i == 0 {
@a.push($i);
@a.push($n/$i) if $i*$i!=$n;
}
}
say $n ~ "(" ~ @a.elems ~ "):" ~ @a.sort.join(",");
$max = @a.elems if @a.elems > $max;
}
say "max:" ~ $max;
}
}
say;
say $max;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment