[Purdue-pm] Perl 6 get primes
mark at purdue.edu
Mon Jun 11 04:57:53 PDT 2018
here is how to get the first 1000 primes in Perl 6:
I read this to myself as
For 1 to whatever if the number is prime save it to
a list and use the first 1000 primes on that list.
NOTE: The is-prime routine reportedly uses the Miller-Rabin primality
test which relies on the unproven extended Riemann hypothesis.
Perl6 computes these in a lazy fashion so they are only computed as they
are used (you can also read this is "as they are needed"). The idea is
don't take the time to compute all of them and then use use one or more
of them at a time---instead compute the ones you need, use them, compute
more, use those, etc.
More information about the Purdue-pm