Handbook
Glossary
primes-between ( low high -- seq )
Prime numbers
Prev:
primes-upto ( n -- seq )
Next:
random-prime ( numbits -- p )
Vocabulary
math
.
primes
Inputs
low
an
integer
high
an
integer
Outputs
seq
a
sequence
Word description
Return a sequence containing all the prime numbers between
low
and
high
.
See also
nprimes
,
primes-upto
Definition
USING:
combinators
kernel
math
math.functions
math.primes.private
;
IN:
math.primes
:
primes-between
( low high -- seq )
[
ceiling
>integer
]
[
floor
>integer
]
bi*
{
{
[
2dup
>
]
[
2drop
V{
}
clone
]
}
{
[
dup
2
=
]
[
2drop
V{
2
}
clone
]
}
{
[
dup
2
<
]
[
2drop
V{
}
clone
]
}
[
(primes-between)
]
}
cond
;