#primality-test #primality #prime #rabin #miller #multi-threading #test

miller_rabin

A multi-threaded, arbitrary precision implementation of the Miller-Rabin primality test

9 stable releases

1.1.1 May 25, 2022
1.1.0 Mar 13, 2022
1.0.6 Mar 1, 2020
1.0.4 Jan 30, 2020
1.0.3 Jan 26, 2020

#941 in Math

Download history 14/week @ 2024-02-18 27/week @ 2024-02-25 21/week @ 2024-03-03 23/week @ 2024-03-10 27/week @ 2024-03-17 19/week @ 2024-03-24 193/week @ 2024-03-31

270 downloads per month
Used in 5 crates (3 directly)

MIT license

8KB
142 lines

miller_rabin

Multi-threaded, arbitrary precision implementation of the Miller-Rabin primality test


lib.rs:

Quick Start

Contained within this module are two functions:

  • is_witness
  • is_prime

The function is_witness performs a single iteration of the Miller-Rabin primality test.

On the other hand, is_prime is a routine that performs the Miller-Rabin primality test a given number of times in parallel, exiting as soon as the iterator encounters a witness for the compositeness of the tested integer.

Dependencies

~2MB
~41K SLoC