Trait nekolib::math::Divisors

source ·
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]);

Required Associated Types§

Required Methods§

source

fn divisors(self) -> Self::Output

Implementations on Foreign Types§

source§

impl Divisors for u64

source§

impl Divisors for u32

source§

impl Divisors for usize

source§

impl Divisors for u128

source§

impl Divisors for u16

source§

impl Divisors for u8

Implementors§