8 unstable releases (3 breaking)

0.4.2 May 5, 2023
0.4.1 May 4, 2023
0.3.1 May 4, 2023
0.2.1 May 4, 2023
0.1.0 May 3, 2023

#388 in Math

Download history 1/week @ 2024-02-16 13/week @ 2024-02-23 1/week @ 2024-03-01 32/week @ 2024-03-08 350/week @ 2024-03-15 67/week @ 2024-03-29

449 downloads per month

MIT license

13KB
183 lines

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

Dependencies

~1MB
~14K SLoC