A class to determine the next
k-smooth number (i.e. a number divisible
only by prime numbers up to
k), given a lower bound
n. Based on
A. Granville,
Smooth numbers: computational number theory and beyond:
5.7. Finding smooth numbers computationally. The obvious
way to find y-smooth numbers in (x; x + z) with z ≤ x is to initialize an
array a[i] := 0 for 1 ≤ i ≤ z (where a[i] corresponds to x + i). For
each successively larger prime power pj ≤ x + z with p ≤ y,
determine the smallest i such that pj divides x + i and then add
log(p) to a[i], a[i + pj], a[i + 2pj] and so on, up
until the end of the array. When we’ve finished, if any a[i] ≥ log(x),
then x + i is y-smooth.