diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-09-29 04:01:09 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-09-29 04:01:09 -0400 |
commit | 2789f9ea1968e6eb0defe06c92cb7a7f544191b3 (patch) | |
tree | b2f75da2d6920d2fc36e97b4cd9bf5ae9fda0f04 | |
parent | 65f117a3696ccaf5c0770968b8a5d3384b2a20c7 (diff) | |
download | projecteuler-2789f9ea1968e6eb0defe06c92cb7a7f544191b3.tar.gz projecteuler-2789f9ea1968e6eb0defe06c92cb7a7f544191b3.zip |
problem 55
-rw-r--r-- | 055.pl | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.014; + +use bigint; + +my $count = 0; +for my $i (1..9999) { + $count++ if lychrel(Math::BigInt->new($i)); +} + +say $count; + +sub lychrel { + my ($i) = @_; + + for my $iter (1..50) { + $i += reverse($i); + return if $i == reverse($i); + } + return 1; +} |