Skip to content

Instantly share code, notes, and snippets.

@ichirin2501
Created August 21, 2012 05:18
Show Gist options
  • Save ichirin2501/3411947 to your computer and use it in GitHub Desktop.
Save ichirin2501/3411947 to your computer and use it in GitHub Desktop.
Project Euler 30
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use List::Util qw/sum/;
# (9^5) + (9^5) + (9^5) + (9^5) + (9^5) + (9^5) = 354294
my @res = grep{ my $t = $_; $t == sum map{$_ ** 5} split(//,$t) } 2..354294;
print sum @res;
# => 443839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment