summaryrefslogtreecommitdiffstats
path: root/036.pl
blob: 8d9fa27dc3667b300b4a571d50ad00c99ebcff59 (plain) (blame)
1
2
3
4
5
6
7
8
9
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";