推了一波式子,先放在这儿备忘,感觉自己从头到尾打一遍就理解了...
这篇主要是给自己看的,回来再写完整笔记...
感觉再也不想碰 latex 了...
公式预警,有恐惧症者勿入...
一、 $$ \sum_{a = 1}^n \sum_{b = 1}^m [(a, b) == 1] $$
$$ \begin{align*} \sum_{a = 1}^n \sum_{b = 1}^m [(a, b) == 1] &= \sum_{a = 1}^n \sum_{b = 1}^m \sum_{d | (a, b)} \mu(d) \\ &= \sum_{d = 1}^{min(n, m)}\mu(d) \times \sum_{a = 1}^n \sum_{b = 1}^m [d \mid (a, b)] \\ &= \sum_{d = 1}^{min(n, m)}\mu(d) \times \sum_{a = 1}^n \sum_{b = 1}^m [d \mid a \land d \mid b] \\ &= \sum_{d = 1}^{min(n, m)}\mu(d) \times \sum_{a = 1}^n [d \mid a] \times \sum_{b = 1}^m [d \mid b] \\ &= \sum_{d = 1}^{min(n, m)}\mu(d) \times \left \lfloor \frac n d \right \rfloor \times \left \lfloor \frac m d \right \rfloor \\ \end{align*} $$
主要依据: $$ \mu * 1 = e $$
二、 $$ \sum_{a = 1}^n \sum_{b = 1}^m (a, b) $$
$$ \begin{align*} \sum_{a = 1}^n \sum_{b = 1}^m (a, b) &= \sum_{a = 1}^n \sum_{b = 1}^m \sum_{d | (a, b)} \varphi(d) \\ &= \sum_{d = 1}^{min(n, m)}\varphi(d) \times \sum_{a = 1}^n \sum_{b = 1}^m [d \mid (a, b)] \\ &= \sum_{d = 1}^{min(n, m)}\varphi(d) \times \sum_{a = 1}^n \sum_{b = 1}^m [d \mid a \land d \mid b] \\ &= \sum_{d = 1}^{min(n, m)}\varphi(d) \times \sum_{a = 1}^n [d \mid a] \times \sum_{b = 1}^m [d \mid b] \\ &= \sum_{d = 1}^{min(n, m)}\varphi(d) \times \left \lfloor \frac n d \right \rfloor \times \left \lfloor \frac m d \right \rfloor \\ \end{align*} $$
主要依据: $$ \varphi * 1 = id $$
三、 $$ \sum_{a = 1}^n \sum_{b = 1}^m \frac {ab} {(a, b)} $$
先证:
$$ \begin{align*} \sum_{a = 1}^{n} \sum_{b = 1}^{m} (ab \times [(a, b) == 1]) &= \sum_{a = 1}^{n} \sum_{b = 1}^{m} (ab \times \sum_{x \mid (a, b)}\mu(x)) \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} \sum_{b = 1}^{m} ab \times [x \mid (a, b)] \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} \sum_{b = 1}^{m} ab \times [x \mid a \land x \mid b] \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} \sum_{b = 1}^{m} ab \times [x \mid a] \times [x \mid b] \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} (a \times [x \mid a] \times \sum_{b = 1}^{m} b \times [x \mid b]) \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} (a \times [x \mid a] \times \sum_{k = 1}^{\left \lfloor \frac {m} {x} \right \rfloor} kx) \\ &= \sum_x^{min(n, m)} \mu(x) \times \sum_{a = 1}^{n} (a \times [x \mid a] \times \frac {x \left \lfloor \frac {m} {x} \right \rfloor (\left \lfloor \frac {m} {x} \right \rfloor + 1)} 2) \\ &= \sum_x^{min(n, m)} \mu(x) \times \frac {x \left \lfloor \frac {m} {x} \right \rfloor (\left \lfloor \frac {m} {x} \right \rfloor + 1)} 2 \times \sum_{a = 1}^{n} (a \times [x \mid a]) \\ &= \sum_x^{min(n, m)} \mu(x) \times \frac {x \left \lfloor \frac {m} {x} \right \rfloor (\left \lfloor \frac {m} {x} \right \rfloor + 1)} 2 \times \sum_{k = 1}^{\left \lfloor \frac {n} {x} \right \rfloor} kx \\ &= \sum_x^{min(n, m)} \mu(x) \times \frac {x \left \lfloor \frac {m} {x} \right \rfloor (\left \lfloor \frac {m} {x} \right \rfloor + 1)} 2 \times \frac {x \left \lfloor \frac {n} {x} \right \rfloor (\left \lfloor \frac {n} {x} \right \rfloor + 1)} 2 \\ &= \frac 1 4 \sum_x^{min(n, m)} \mu(x) x^2 \left \lfloor \frac {n} {x} \right \rfloor \left \lfloor \frac {m} {x} \right \rfloor (\left \lfloor \frac {n} {x} \right \rfloor + 1) (\left \lfloor \frac {m} {x} \right \rfloor + 1) \end{align*} $$
再推:
$$ \begin{align*} \sum_{a = 1}^n \sum_{b = 1}^m \frac {ab} {(a, b)} &= \sum_d^{min(n, m)} \sum_{a = 1}^n \sum_{b = 1}^m (\frac {ab} d \times [(a, b) == d]) \\ &= \sum_d^{min(n, m)} d \times \sum_{a = 1}^{\left \lfloor \frac n d \right \rfloor} \sum_{b = 1}^{\left \lfloor \frac m d \right \rfloor} (ab \times [(a, b) == 1]) \\ &= \frac 1 4 \sum_d^{min(n, m)} d \sum_x \mu(x) x^2 \left \lfloor \frac {\left \lfloor \frac n d \right \rfloor} {x} \right \rfloor \left \lfloor \frac {\left \lfloor \frac m d \right \rfloor} {x} \right \rfloor (\left \lfloor \frac {\left \lfloor \frac n d \right \rfloor} {x} \right \rfloor + 1) (\left \lfloor \frac {\left \lfloor \frac m d \right \rfloor} {x} \right \rfloor + 1) \\ &= \frac 1 4 \sum_d^{min(n, m)} d \sum_x \mu(x) x^2 \left \lfloor \frac {n} {xd} \right \rfloor \left \lfloor \frac {m} {xd} \right \rfloor (\left \lfloor \frac {n} {xd} \right \rfloor + 1) (\left \lfloor \frac {m} {xd} \right \rfloor + 1) \\ &= \frac 1 4 \sum_T \left \lfloor \frac {n} {T} \right \rfloor \left \lfloor \frac {m} {T} \right \rfloor (\left \lfloor \frac {n} {T} \right \rfloor + 1) (\left \lfloor \frac {m} {T} \right \rfloor + 1) T\sum_{x \mid T} x\mu(x) \end{align*} $$