DADiSP Worksheet Functions > Function Categories > Fourier Transforms and Signal Processing > FACTORS
Returns the prime factors of a scalar.
FACTORS(ival)
ival |
- |
An integer, the value to factor. |
A series.
factors(357)
returns the series: {3, 7, 17}.
p = factors(1975);
q = cumprod(p);
r = colreduce(p, "*");
s = prod(p);
p == {5, 5, 79}
q == {5, 25, 1975}
r == {1975}
s == 1975
factors(19)
returns the series: {19}. 19 is a prime number, so there is only one point in the resulting series.
FACTORS is particularly useful in determining whether a series length is prime. The FFT algorithm runs slowest on series with prime lengths.
See PROD to multiply the values of a series and return a scalar.