Skip to content

FedericoStra/smooth-numbers

Repository files navigation

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

About

Algorithms to generate smooth numbers

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published