//! Elementary number theory on fixed-width integers — the Euclidean core.
//!
//! `gcd` and `extended_gcd` are the oldest live algorithms in the stack and the
//! common ancestor of modular inverse and the Chinese Remainder Theorem here —
//! and, in later layers, of finite-field inversion and lattice size-reduction.
//! They operate on **public** values; constant-time variants for secret operands
//! belong to the constant-time field layer, not here.

mod certificate;
mod cfrac;
mod crt;
mod euclid;
mod factor;
mod modular;
mod primality;
mod quadratic;
mod roots;
mod structure;

#[cfg(test)]
mod tests;

pub use certificate::{
    PrimalityCertificate, is_prime_certified, prime_certificate, verify_certificate,
};
pub use cfrac::{ContinuedFraction, Convergents, continued_fraction};
pub use crt::{crt, crt2};
pub use euclid::{extended_gcd, gcd, lcm};
pub use factor::{Factorization, factorize};
// Crate-internal: exposed only so the Kani harness in proofs/factor_sort.rs
// can prove its postconditions. Not part of the public API.
#[cfg(kani)]
pub(crate) use factor::sort_factors;
pub use modular::{modinv, modpow, mulmod};
pub use primality::{
    Rng, bpsw, is_lucas_probable_prime, is_prime, is_strong_probable_prime, next_prime,
    random_prime,
};
pub use quadratic::{jacobi, kronecker, sqrtmod};
pub use roots::{iroot, isqrt};
pub use structure::{carmichael, order, primitive_root, totient};
