From ecfcca386aec6e8f1ebcf35dd175bf7b6bbea09f Mon Sep 17 00:00:00 2001 From: drbaggy Date: Tue, 16 Nov 2021 07:41:23 +0000 Subject: change while to for --- 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 5f3150a086..85c743084c 100644 --- a/challenge-139/james-smith/perl/ch-2.pl +++ b/challenge-139/james-smith/perl/ch-2.pl @@ -8,7 +8,7 @@ use feature qw(say); my( $N, $p, @primes, @long_primes ) = ( @ARGV ? $ARGV[0] : 5, 1, 2 ); -O: while( (@long_primes < $N) && ($p += 2) ) { +O: for( my $p=3; @long_primes<$N; $p+=2 ) { ($p % $_) || (next O) for @primes; ## next if not prime... push @long_primes, $p if $p - rec_len($p) == 1; push @primes, $p; -- cgit