\HeaderA{nextn}{Highly Composite Numbers}{nextn}
\keyword{math}{nextn}
\begin{Description}\relax
\code{nextn} returns the smallest integer,
greater than or equal to \code{n}, which can be obtained
as a product of powers of the values contained in \code{factors}.
\code{nextn} is intended to be used to find a suitable length
to zero-pad the argument of \code{fft} to
so that the transform is computed quickly.
The default value for \code{factors} ensures this.
\end{Description}
\begin{Usage}
\begin{verbatim}
nextn(n, factors = c(2,3,5))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{n}] an integer.
\item[\code{factors}] a vector of positive integer factors.
\end{ldescription}
\end{Arguments}
\begin{SeeAlso}\relax
\code{\LinkA{convolve}{convolve}}, \code{\LinkA{fft}{fft}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
nextn(1001) # 1024
table(sapply(599:630, nextn))
\end{ExampleCode}
\end{Examples}

