goodfactors(n), n an integer scalar or vector |

goodfactors(n), where n is a vector of positive integers < 2^52 = 4503599627370496, returns an integer vector the same length as n whose i-th element is the smallest integer >= n[i] having no prime factors larger than 29. It is designed to be used to choose legal lengths of vectors to be Fourier transformed using rft(), hft() or cft(). goodfactors(n,m), where n is the same and m is a positive integer scalar, does the same, except the i-th element of the result is the smallest integer >= n[i] having no prime factors larger than m. NOTE: Because the product of "unpaired" prime factors can't be too large, it is not guaranteed that a value returned by goodfactors() is actually a legal length for the Fourier transform functions. For example, goodfactors(255255) = 255255, but 255255 = 3*5*7*11*13*17 is not a legal length. Example: Cmd> goodfactors(vector(217,1409)) (1) 220 1421 See also primefactors(), cft(), hft(), rft().

Gary Oehlert 2003-01-15