Crates.io | smooth-numbers |
lib.rs | smooth-numbers |
version | 0.4.2 |
source | src |
created_at | 2023-05-03 15:19:26.048144 |
updated_at | 2023-05-05 13:58:57.243578 |
description | Algorithms to generate smooth numbers |
homepage | |
repository | https://github.com/FedericoStra/smooth-numbers |
max_upload_size | |
id | 855564 |
size | 36,632 |
Algorithms to generate smooth numbers
See the definition of smooth number on Wikipedia and MathWorld.
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]
);