From b8efdcfb01a416ff48e80d4ef8c30e98039adde3 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Thu, 18 Nov 2021 17:19:50 +0000 Subject: add a length $D to this to make sure we get enough of the repeat --- challenge-139/james-smith/perl/ch-2.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-139/james-smith/perl/ch-2.pl b/challenge-139/james-smith/perl/ch-2.pl index cd0c2c56ca..c828aefea7 100644 --- a/challenge-139/james-smith/perl/ch-2.pl +++ b/challenge-139/james-smith/perl/ch-2.pl @@ -16,6 +16,6 @@ say $_ for @long_primes; sub rec_len { my( $D, $N, $s ) = ( shift, 1, '' ); - $s.=int($N/$D),$N%=$D,$N.=0 for 0..2*$D; + $s.=int($N/$D),$N%=$D,$N.=0 for 0..2*$D+length $D; $s =~ /(.+?)\1+$/ ? length $1 : 0; } -- cgit