Jump to content

Fermat pseudoprimes: Difference between revisions

m
→‎{{header|Raku}}: better parenthesis placement
m (better title)
m (→‎{{header|Raku}}: better parenthesis placement)
Line 54:
my @pseudo = lazy (1..*).hyper.grep: { !.is-prime && (exp($_ - 1, $base) % $_ == 1) }
my $threshold = 50000;
say $base.fmt("Base %2d - Up to $threshold: ") ~ (+@pseudo.&upto: $threshold).fmt('%5d')
~ " First 20: ") ~ @pseudo[^20].gist
}</lang>
<pre>Base 1 - Up to 50000: 44866 First 20: (4 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32)
10,327

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.