Handbook
Glossary
nprimes ( n -- seq )
Vocabulary
math
.
primes
Inputs
n
a non-negative integer
Outputs
seq
a
sequence
Word description
Return a sequence containing the
n
first primes numbers.
See also
primes-upto
,
primes-between
Definition
USING:
kernel
sequences
;
IN:
math.primes
:
nprimes
( n -- seq )
2
swap
[
[
next-prime
]
keep
]
replicate
nip
;