Skip to content

Instantly share code, notes, and snippets.

Created August 25, 2010 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/549562 to your computer and use it in GitHub Desktop.
Save anonymous/549562 to your computer and use it in GitHub Desktop.
my $palindromNumbersSum = 0;
loop (my $i = 9; $i <= 1000000; $i++) {
if ( ($i.flip == $i) && (sprintf('%b',$i).flip == sprintf('%b',$i)) ) {
$palindromNumbersSum += $i;
}
if ($i%1000 == 0) {
say $i;
}
}
say $palindromNumbersSum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment