R - nextn(): highly composite numbers

14 Aug 2019

nextn(n, factors) returns the smallest integer, greater than or equal to n, which can be obtained as a product of powers of the values contained in factors.

NB: Discrete Fourier Transforms (DFT) algorithms are most efficient for “Highly Composite Numbers”, specifically multiples of (2,3,5)

nextn(1001) # default: nextn(1001, factors=c(2,3,5))
#[1] 1024
[ R  function  ]