Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 26 lines (20 sloc) 0.394 kB
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Math::BigInt;
use List::Util qw(sum);
sub digit_sum {
my ($n) = @_;
my @digits = split //, $n;
return sum @digits;
}
my $max = 0;
for $a ( 1 .. 99 ) {
for $b ( 1 .. 99 ) {
my $n = Math::BigInt->new($a)->bpow($b);
my $sum = digit_sum("$n");
$max = $sum if $sum > $max;
}
}
say $max;
Jump to Line
Something went wrong with that request. Please try again.