#primality #primality-test #prime #rabin

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

#1203 in Math

Download history 29/week @ 2024-06-17 24/week @ 2024-06-24 6/week @ 2024-07-01 10/week @ 2024-07-08 34/week @ 2024-07-15 16/week @ 2024-07-22 73/week @ 2024-07-29 24/week @ 2024-08-05 31/week @ 2024-08-12 22/week @ 2024-08-19 56/week @ 2024-08-26 29/week @ 2024-09-02 33/week @ 2024-09-09 21/week @ 2024-09-16 59/week @ 2024-09-23 37/week @ 2024-09-30

154 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