Handbook
Glossary
unique-primes ( n numbits -- seq )
Prime numbers
Prev:
find-relative-prime* ( n guess -- p )
Vocabulary
math
.
primes
Inputs
n
an
integer
numbits
an
integer
Outputs
seq
a
sequence
Word description
Generates a sequence of
n
unique prime numbers with exactly
numbits
bits.
Definition
USING:
kernel
math
sequences
sets
;
IN:
math.primes
:
unique-primes
( n numbits -- seq )
2dup
2^
estimated-primes
>
[
too-few-primes
]
when
2dup
[
random-prime
]
curry
replicate
dup
all-unique?
[
2nip
]
[
drop
unique-primes
]
if
;