#integer #find #vector

factor

Find the factors for any integer

4 releases (breaking)

Uses old Rust 2015

0.4.0 Sep 8, 2018
0.3.0 Sep 5, 2018
0.2.0 Sep 5, 2018
0.1.0 Sep 3, 2018

#309 in #find

Download history 1/week @ 2024-11-13 7/week @ 2024-11-20 7/week @ 2024-11-27 17/week @ 2024-12-04 28/week @ 2024-12-11 3/week @ 2024-12-18 33/week @ 2025-01-01 8/week @ 2025-01-08 13/week @ 2025-01-15 10/week @ 2025-01-22 15/week @ 2025-01-29 31/week @ 2025-02-05 33/week @ 2025-02-12 21/week @ 2025-02-19 29/week @ 2025-02-26

118 downloads per month
Used in cega

MIT/Apache

6KB

Factor

Find the factors for any integer.

Usage

Cargo.toml

[dependencies]
factor = "0.4"

Add this to your crate root -

extern crate factor;

use factor::factor::factor;
use factor::factor_include::factor_include;

factor() - Will return factors of a given integer EXCLUDING 1 and the given number.

factor_include() - Will return factors of a given integer INCLUDING 1 and the given number.

***Note : Factors are returned in a vector.

#Examples::

-println!("{:?}", factor(144));
    -Prints [2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 36, 48, 72]
-println!("{:?}", factor_include(144));
    -Prints [1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 36, 48, 72, 144]

lib.rs:

 factor() - Will return factors of a given integer EXCLUDING 1 and the given number.

 factor_include() - Will return factors of a given integer INCLUDING 1 and the given number.

No runtime deps