k-Wave Toolbox
k-Wave Toolbox Previous   Next

checkFactors

Return the maximum prime factor for a range of numbers

Syntax

checkFactors(min_number, max_number)

Description

checkFactors loops through the given range of numbers and finds the numbers with the smallest maximum prime factors. This allows suitable grid sizes to be selected to maximise the speed of the FFT (this is fastest for FFT lengths with small prime factors).

For example, running the code checkFactors(100, 200) produces the output

Numbers with a maximum prime factor of 2
128
Numbers with a maximum prime factor of 3
108  144  162  192
Numbers with a maximum prime factor of 5
100  120  125  135  150  160  180  200
Numbers with a maximum prime factor of 7
105  112  126  140  147  168  175  189  196
Numbers to avoid (prime numbers)
101  103  107  109  113  127  131  137  139  149  151  157  163  167  173  179  181  191  193  197  199

See Also

fft, factor


© 2009-2014 Bradley Treeby and Ben Cox.