Truncatable primes: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: prime tester was technically incorrect on 2, though we never test even numbers here |
→{{header|Perl 6}}: avoid X which is slow in rakudo, and this matches the rtp solution better anyway |
||
Line 1,100:
sub ltp {
for
for 9...1 -> $b {
my @x := [\+] $f, $e, $d, $c, $b, $a Z* (1,10,100 ... *);▼
for 9...1 -> $d {
for 9...1 -> $e {
for 9,7,3 -> $f {
return @x[*-1] if not grep {not prime $^n}, @x;
}
}
}
}
}
}
}
|