I was taking the determinant of the adjacency matrix for a graph and I stumbled across this interesting (apparent) coincidence:
If $m$ and $n$ are odd numbers, then $$ 2^{\textsf{gcd}(m,n)} = \prod_{k=1}^{m} \prod_{l=1}^{n} \left( e^{\frac{2k\pi i}{m}} + e^{\frac{2 l \pi i}{n}} \right).$$
If we take $\log_2$ of both sides, we get an explicit expression describing the greatest common divisor. Would anyone like to attempt a proof of this fact?
Here is some MATLAB code which checks the above formula. (Save it as a *.m file in your MATLAB directory; then use greatcd(m,n)
to output the greatest common divisor of your chosen odd numbers $m$ and $n$.)
function [I,J] = greatcd(m,n)
for k=1:m
for l=1:n
H(k,l) = exp((2*pi*i*k)/m) + exp((2*pi*i*l)/n);
end
end
G=prod(H(:));
log2(real(G))
It appears that if $g = \textsf{gcd}(m,n)$, then $$\prod_{k=1}^{m} \prod_{l=1}^{n} \left( e^{\frac{2k\pi i}{m}} + e^{\frac{2 l \pi i}{n}} \right) = \prod_{k=1}^{g} \prod_{l=1}^{ng^{-1}} \left( 1 + e^{\frac{2l\pi i}{ng^{-1}}}\right)$$ and I also think that $$ \prod_{l=1}^{ng^{-1}} \left( 1 + e^{\frac{2l\pi i}{ng^{-1}}}\right) = 2.$$ If I hold $l$ fixed and take the product over $k$, I appear to get $$\prod_{k=1}^{m} \left( e^{\frac{2k\pi i}{m}} + e^{\frac{2 l \pi i}{n}} \right) = 1 + e^{\frac{2l\pi i}{ng^{-1}}}.$$