#prime #numbers #mersenne #generate #miller-rabin #test #check

mersenne-prime-number-miller-rabin

This package provides function to generate Mersenne number and test primality with Miller-Rabin Algorithme

1 unstable release

0.1.0 Mar 28, 2023

#1830 in Math

GPL-2.0-or-later

97KB
907 lines

Mersenne Prime - Rust

This package it's develop to study Mersenne prime number. It hava functions for generate Mersenne number and check if it's probabily prime with Miller-Rabin Algorithm.

Mersenne Number

Numbers of the form $M_n=2^n-1$ are called Mersenne numbers. If $M_n$ is prime, $n$ is also prime, but the converse is not true. The smallest counterexample is $M_{11}=2047=23\cdot 89$.

Mersenne prime - Wikipedia

Miller-Rabin Algorithm

Miller-Rabin is an algorithm check if a number is probabily prime or composite. Miller-Rabin Algorithm - Wikipedia

Package

Documentation

Check on crate.io

Install

Put this code on your Cargo.toml

[dependencies]
mersenne-prime-number-miller-rabin = "0.1.0"

Exemple

Let's see a basic exemple

use mersenne_prime_number_miller_rabin::is_prime;
use mersenne_prime_number_miller_rabin::mersenne_number;

let one_mersenne_number = mersenne_number(61);
let is_prime_result = is_prime(one_mersenne_number);
println!("Is prime ? {} ", is_prime_result);

Dependencies

~480KB
~10K SLoC