summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-15 18:05:15 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-15 18:05:15 -0500
commitf2d2341ab1e322fb986a9a6ef4681234d28eabe0 (patch)
tree069aafc1f821d11223da1a142f88b22ec393c9d3
parentdb1d685414ac9257082803be8af9b27a088d8938 (diff)
downloadprojecteuler-f2d2341ab1e322fb986a9a6ef4681234d28eabe0.tar.gz
projecteuler-f2d2341ab1e322fb986a9a6ef4681234d28eabe0.zip
solution to 36
-rwxr-xr-x036.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/036.pl b/036.pl
new file mode 100755
index 0000000..8d9fa27
--- /dev/null
+++ b/036.pl
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $total = 0;
+for my $n (1..1e6) {
+ my $n2 = sprintf "%b", $n;
+ $total += $n if $n eq reverse($n) and $n2 eq reverse($n2);
+}
+print "$total\n";