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 |
#795 in Math
73 downloads per month
14KB
194 lines
smooth-numbers
Algorithms to generate smooth numbers
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