Using trigonometry functions to find a number's integer factors?

205 Views Asked by At

So I found out that using these two equations:

x*y=n
sin(x*pi)=sin(n*pi/x)=0

a list of factors to n could be found.

currently, the best single function that finds all integer factors is $$ \left|\cos\left(x\pi\right)\right|+\left|\cos\left(\frac{n\pi}{x}\right)\right|=2 $$

this is the best I could find. My question is, is this a reliable way to find factors for n, and if not, what are some better ways?

1

There are 1 best solutions below

0
On BEST ANSWER

Both formulas base on a simple property of the sine- and the cosine-function. $$\sin{\pi x}=0$$ holds if and only if $x$ is an integer and $$|\cos{\pi x}|=1$$ holds if and only if $x$ is an integer. So, the method actually works for all $n$.