Chernick's Carmichael numbers: Difference between revisions
m
→{{header|Raku}}: note use of 'ntheory' module
(Chernick's Carmichael numbers in FreeBASIC) |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: note use of 'ntheory' module) |
||
Line 1,354:
=={{header|Raku}}==
(formerly Perl 6)
{{trans|Perl}}▼
Use the ntheory library from Perl 5 for primality testing since it is much, ''much'' faster than Rakus built-in .is-prime method.▼
▲Use the ntheory library from Perl
▲{{trans|Perl}}
{{libheader|ntheory}}
<lang perl6>use Inline::Perl5;
use ntheory:from<Perl5> <:all>;
sub chernick-factors ($n, $m) {
}
Line 1,368:
my $multiplier = 1 +< (($n-4) max 0);
my $iterator = $n < 5 ?? (1 .. *) !! (1 .. *).map: *
$multiplier
[&&] chernick-factors($n, $m
}
Line 1,379:
my $m = chernick-carmichael-number($n);
my @f = chernick-factors($n, $m);
say "U($n, $m): {[
}</lang>
{{out}}
|