smooth-numbers

Crates.iosmooth-numbers
lib.rssmooth-numbers
version0.4.2
sourcesrc
created_at2023-05-03 15:19:26.048144
updated_at2023-05-05 13:58:57.243578
descriptionAlgorithms to generate smooth numbers
homepage
repositoryhttps://github.com/FedericoStra/smooth-numbers
max_upload_size
id855564
size36,632
Federico Stra (FedericoStra)

documentation

README

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]
);
Commit count: 26

cargo fmt