P39 - 素数列表。

作者:Curtis "Ovid" Poe

规范

P39 (*) A list of prime numbers.
  Given a range of integers by its lower and upper limit, construct a list
  of all prime numbers in that range.

示例

> say ~ grep { .is-prime }, 10..19;
11 13 17 19

源代码: P39-rhebus.pl

use v6;

# we can call it with a range, as in the specification...
say ~ grep { .is-prime }, 10..20;

# or we can pass a list...
say ~ grep { .is-prime }, 3,5,17,257,65537;
# or another range
say ~ grep { .is-prime }, 1..100;