Show that for all positive integers $m$ and $n$, \[\gcd(m, n) = m+n-mn+2\sum^{m-1}_{k=0}\left \lfloor \frac{kn}{m}\right \rfloor.\]
Problem
Source:
Tags: floor function
21.10.2007 06:11
Peter wrote: Show that for all positive integers $ m$ and $ n$, \[ \gcd(m, n) = m + n - mn + 2\sum^{m - 1}_{k = 0}\left \lfloor \frac {kn}{m}\right \rfloor. \] This problem must be : $ d = \gcd(m,n)$ so $ [\frac {kn}{m}] = [\frac {ka}{b}]$ But $ \{ka\}_{k = 0}^{b - 1}$ is an complete reside mod $ b$ then $ \sum_{k = 0}^{b - 1}\{\frac {ka}{b}\} = \frac {b(b - 1)}{2b}$ So $ \sum_{k = 0}^{b - 1}[\frac {ka}{b}] = \frac {(a - 1)(b - 1)}{2}$ $ \Rightarrow \sum_{k = 1}^{m - 1}[\frac{ka}{b}] = d(a - 1)(b - 1) = d + mn - m - n$ So the equality is true.
21.10.2007 07:49
TTsphn wrote: So $ \sum_{k = 0}^{b - 1}[\frac {ka}{b}] = \frac {(a - 1)(b - 1)}{2}$ $ \Rightarrow \sum_{k = 1}^{m - 1}[\frac {ka}{b}] = d(a - 1)(b - 1) = d + mn - m - n$ So the equality is true. Exactly $ 2\sum_{k=1}^{m-1}[\frac{kn}{m}]=n(m-1)-d(b-1)=d+nm-n-m.$
21.10.2007 15:00
Please see http://www.mathlinks.ro/Forum/viewtopic.php?t=59747 .