Skip to content

Instantly share code, notes, and snippets.

@yuuki
Created August 19, 2012 17:21
Show Gist options
  • Select an option

  • Save yuuki/3396440 to your computer and use it in GitHub Desktop.

Select an option

Save yuuki/3396440 to your computer and use it in GitHub Desktop.
use 5.010;
use List::Util qw(sum);
my @maxs = map { $_ ** 2 } map { 2 * $_ - 1 } 1 .. 501;
my $step = sub { my $i = shift; ($i + 1) * 2; };
say sum(map { $maxs[$_] * 4 + $step->($_) * 6 } 0 .. ($#maxs-1)) + $maxs[$#maxs];
# 669171001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment