Skip to content

Instantly share code, notes, and snippets.

@ichirin2501
Created August 19, 2012 04:05
Show Gist options
  • Save ichirin2501/3391833 to your computer and use it in GitHub Desktop.
Save ichirin2501/3391833 to your computer and use it in GitHub Desktop.
Project Euler 28
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use List::Util qw/sum/;
my $i;
my $res = 0;
for($i=1; $i<=999; $i+=2){
$res += sum( map{ $i**2 + ($i + 1) / 2 * 2 * $_ } 0..3 );
}
print $res + $i**2, "\n";
# => 669171001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment