acm 0.1.3

Arithmetic congruence monoid implementation in Rust
Documentation
/// Returns the prime power factorization of an integer.
///
/// # Examples
/// ```
/// assert_eq!(acm::factorize(120), [(2, 3), (3, 1), (5, 1)]);
/// ```
pub fn factorize(mut n: u32) -> Vec<(u32, u32)> {
    let mut pfs: Vec<(u32, u32)> = Vec::new();
    let mut d = 2;
    while n > 1 {
        while n % d != 0 {
            d += 1;
        }
        let mut q = n / d;
        let mut i: u32 = 1;
        while q % d == 0 {
            q /= d;
            i += 1;
        }
        pfs.push((d, i));
        n /= d.pow(i);
    }
    pfs
}