diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-15 18:09:58 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-15 18:09:58 -0500 |
commit | 49260ea122d3e6c5e1aab89e65b8cb8cdb10df48 (patch) | |
tree | 07817bd2d079b05dc587cf93f1cf8b33b4692d58 /034.pl | |
parent | f2d2341ab1e322fb986a9a6ef4681234d28eabe0 (diff) | |
download | projecteuler-49260ea122d3e6c5e1aab89e65b8cb8cdb10df48.tar.gz projecteuler-49260ea122d3e6c5e1aab89e65b8cb8cdb10df48.zip |
problem 34 solution
Diffstat (limited to '034.pl')
-rwxr-xr-x | 034.pl | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -0,0 +1,13 @@ +#!/usr/bin/perl +use strict; +use warnings; +use List::Util qw/sum/; +use Math::Combinatorics qw/factorial/; + +my @numbers; +for my $i (10..500000) { + my @digits = split //, $i; + my $sum = sum map { factorial($_) } @digits; + push @numbers, $i if $i == $sum; +} +print join('+', @numbers), ' = ', sum(@numbers), "\n"; |