EVOLUTION-MANAGER
Edit File: nextn.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Find Highly Composite Numbers</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for nextn {stats}"><tr><td>nextn {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Find Highly Composite Numbers</h2> <h3>Description</h3> <p><code>nextn</code> returns the smallest integer, greater than or equal to <code>n</code>, which can be obtained as a product of powers of the values contained in <code>factors</code>. </p> <p><code>nextn()</code> is intended to be used to find a suitable length to zero-pad the argument of <code><a href="fft.html">fft</a></code> so that the transform is computed quickly. The default value for <code>factors</code> ensures this. </p> <h3>Usage</h3> <pre> nextn(n, factors = c(2,3,5)) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>n</code></td> <td> <p>a vector of integer numbers (of type <code>"integer"</code> <em>or</em> <code>"double"</code>).</p> </td></tr> <tr valign="top"><td><code>factors</code></td> <td> <p>a vector of positive integer factors (at least <i>2</i> and preferably relative prime, see the note).</p> </td></tr> </table> <h3>Value</h3> <p>a vector of the same <code><a href="../../base/html/length.html">length</a></code> as <code>n</code>, of type <code>"integer"</code> when the values are small enough (determined before computing them) and <code>"double"</code> otherwise. </p> <h3>Note</h3> <p>If the factors in <code>factors</code> are <em>not</em> relative prime, i.e., have themselves a common factor larger than one, the result may be wrong in the sense that it may not be the <em>smallest</em> integer. E.g., <code>nextn(91, c(2,6))</code> returns 128 instead of 96 as <code>nextn(91, c(2,3))</code> returns. </p> <p>When the resulting <code>N <- nextn(..)</code> is larger than <code>2^53</code>, a warning with the true 64-bit integer value is signalled, as integers above that range may not be representable in double precision. </p> <p>If you really need to deal with such large integers, it may be advisable to use package <a href="https://CRAN.R-project.org/package=gmp"><span class="pkg">gmp</span></a>. </p> <h3>See Also</h3> <p><code><a href="convolve.html">convolve</a></code>, <code><a href="fft.html">fft</a></code>. </p> <h3>Examples</h3> <pre> nextn(1001) # 1024 table(nextn(599:630)) n <- 1:100 ; plot(n, nextn(n) - n, type = "o", lwd=2, cex=1/2) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>