#prime #primality-test #primality

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

#1361 in Math

Download history 18/week @ 2024-07-21 72/week @ 2024-07-28 24/week @ 2024-08-04 28/week @ 2024-08-11 21/week @ 2024-08-18 40/week @ 2024-08-25 47/week @ 2024-09-01 33/week @ 2024-09-08 23/week @ 2024-09-15 52/week @ 2024-09-22 43/week @ 2024-09-29 3/week @ 2024-10-06 13/week @ 2024-10-13 15/week @ 2024-10-20 18/week @ 2024-10-27 16/week @ 2024-11-03

62 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