Handbook
Glossary
miller-rabin* ( n numtrials -- ? )
Miller-Rabin probabilistic primality test
Prev:
miller-rabin ( n -- ? )
Vocabulary
math
.
primes
.
miller-rabin
Inputs
n
an
integer
numtrials
an
integer
Outputs
?
a
boolean
Word description
Performs
numtrials
trials of the Miller-Rabin probabilistic primality test algorithm and returns true if prime.
See also
miller-rabin
Definition
USING:
combinators
kernel
math
math.primes.miller-rabin.private
;
IN:
math.primes.miller-rabin
:
miller-rabin*
( n numtrials -- ? )
{
{
[
over
1
<=
]
[
2drop
f
]
}
{
[
over
even?
]
[
drop
2
=
]
}
[
(miller-rabin)
]
}
cond
;