调和级数
结论:
\(\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \cdots + \frac{1}{n-1} + \frac{1}{n} \le \log_2 n\)
- 该结论常用于分析时间复杂度
- 比如这一题:点我查看
证明:
公式推导如下 |
---|
\(\frac{1}{1} \le \frac{1}{1}\) |
\(\frac{1}{1} + (\frac{1}{2}) \le \frac{1}{1} + \frac{1}{1}\) |
\(\frac{1}{1} + \frac{1}{2} + (\frac{1}{3} + \frac{1}{4}) \le \frac{1}{1} + \frac{1}{1} + \frac{1}{2}\) |
\(\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + (\frac{1}{5} + \frac{1}{6} + \frac{1}{7} + \frac{1}{8}) \le \frac{1}{1} + \frac{1}{1} + \frac{1}{2} + \frac{1}{4}\) |
\(\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \frac{1}{6} + \frac{1}{7} + \frac{1}{8} + (\frac{1}{9} + \frac{1}{10} + \frac{1}{11} + \frac{1}{12} + \frac{1}{13} + \frac{1}{14} + \frac{1}{15} + \frac{1}{16}) \le \frac{1}{1} + \frac{1}{1} + \frac{1}{2} + \frac{1}{4} + \frac{1}{8}\) |
- 上面这些公式显然是正确的
- 那么发现 \(n\) 不断 \(\times 2\),则 \(\frac{1}{1} + \frac{1}{2} + \cdots + \frac{1}{n}\) 不断 \(+1\)
- 那么便证明除了一开始的结论