I was messing around with values of the tangent function and came across something interesting. For example, we have $$\tan^2(\frac{\pi}{4\cdot2}) = \dfrac{\sqrt{4} - \sqrt{2}}{\sqrt{4} + \sqrt{2}}, \tan^2(\frac{\pi}{3\cdot4}) = \dfrac{\sqrt{4} - \sqrt{3}}{\sqrt{4} + \sqrt{3}}, \tan^2(\frac{\pi}{1\cdot1}) = \frac{\sqrt{1} - \sqrt{1}}{\sqrt{1} + \sqrt{1}}.$$
All of these values satisfy $$\tan^2(\frac{\pi}{m\cdot n}) = \dfrac{\sqrt{m} - \sqrt{n}}{\sqrt{m} + \sqrt{n}}.$$
How could I go about to find all pairs $(m,n)$ which satisfy the equation?