gaussiant

Crates.iogaussiant
lib.rsgaussiant
version0.8.0
sourcesrc
created_at2022-01-24 23:26:57.999028
updated_at2022-02-09 16:58:23.809121
descriptionGaussian integers
homepage
repositoryhttps://github.com/pierwill/gaussiant
max_upload_size
id520479
size64,312
(pierwill)

documentation

README

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()
    );
}
Commit count: 107

cargo fmt