Is there an algorithm to find the nearest number with only small factors?
<p>I need to do some real time DFT and the algorithm I am using is the most efficient when the number of samples can be broken down into small factors.</p>

<p>Suppose that I have a number <code>n</code> and factors <code>2, 3, 5</code>. How to find the nearest number (compared to <code>n</code>) whose prime factorisation consists of no numbers other than <code>2,3,5</code>?</p>

<p><code>n</code> is almost always below <code>50,000</code> so brute forcing might be a good idea.</p>