Crate divisors_fixed

Source
Expand description

§divisors_fixed

A minimalistic crate for finding all divisors of an integer. Although its worst-case time complexity is (currently) still O(sqrt(n)), It is practically much faster than the naive method of trying every integers under sqrt(n).

This library works with u8, u16, u32, u64, u128, and usize types.

This originally started as a clone of the divisors crate with bug fixes (hence the name), but has since evolved with API changes and reimplementations.

§Example

use divisors_fixed::Divisors;
assert_eq!(12u32.divisors(), vec![1, 2, 3, 4, 6, 12]);

Traits§

Divisors
Trait for getting all positive divisors of an integer.