11 releases (7 breaking)

0.8.0 Feb 9, 2022
0.7.0 Feb 1, 2022
0.6.0 Jan 31, 2022
0.5.1 Jan 30, 2022
0.1.1 Jan 27, 2022

#1637 in Math

Download history 1/week @ 2024-02-18 5/week @ 2024-02-25 7/week @ 2024-03-10 173/week @ 2024-03-31

180 downloads per month

MIT/Apache

36KB
682 lines

crate documentation stable nightly

A Gaussian integer is a complex number whose real and imaginary parts are both integers.

gaussiant provides the GaussianInt type, which is a wrapper around num_complex::Complex with additional methods for number theoretical computation.

Example

If a prime number p is congruent to 3 modulo 4, then it is a Gaussian prime (Wikipedia).

use gaussiant::{GaussianInt, gaussint};

fn main() {
    let p = gaussint!(7);
    assert_eq!(
        p.congruent(gaussint!(3), gaussint!(4)),
        p.is_gaussian_prime()
    );
}

Dependencies

~1–4.5MB
~55K SLoC