pub trait Divisors {
type Output;
// Required method
fn divisors(self) -> Self::Output;
}
Expand description
約数列挙。
Complexity
$O(\sqrt{n})$ time, $O(1)$ space.
Examples
use nekolib::math::Divisors;
let div: Vec<_> = 60_u64.divisors().collect();
assert_eq!(div, [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60]);