Truncatable primes: Difference between revisions

Content deleted Content added
Line 250:
}
 
sub trunc_prime ($filtertype, $limit) {
my $odd = $limit + ($limit % 2 ?? 0 !! 1);
loopfor (my $loop = $odd;, $loop* -= 2; $loop... * <= 2) )-> $loop {
next if $loop ~~ /0/; # No zeros allowed
my $this = $loop;
while $this.&isprime {
$this.=subst($filtertype, '');
return $loop ifunless $this eq '';
}
}