#primality-test #prime #primality #rabin #miller #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

#1513 in Math

Download history 10/week @ 2024-11-13 30/week @ 2024-11-20 30/week @ 2024-11-27 34/week @ 2024-12-04 49/week @ 2024-12-11 13/week @ 2024-12-18 13/week @ 2025-01-08 23/week @ 2025-01-15 13/week @ 2025-01-22 9/week @ 2025-01-29 8/week @ 2025-02-05 48/week @ 2025-02-12 11/week @ 2025-02-19 35/week @ 2025-02-26

104 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