Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.45 KB

README.md

File metadata and controls

38 lines (28 loc) · 1.45 KB

smooth-numbers

Algorithms to generate smooth numbers

crates.io docs.rs GitHub GitHub Workflow Status Dependencies status MIT license

See the definition of smooth number on Wikipedia and MathWorld.

Examples

Compute the first 10 3-smooth numbers, i.e. numbers of the form 2^i * 3^j:

use smooth_numbers::*;

assert_eq!(
    smooth(3, 10),
    [1, 2, 3, 4, 6, 8, 9, 12, 16, 18]
);

Compute the first 10 numbers of the form 2^i * 5^j:

use smooth_numbers::*;

assert_eq!(
    with_primes(&[2, 5], 10),
    [1, 2, 4, 5, 8, 10, 16, 20, 25, 32]
);