调和级数时间复杂度

The key is that

11+12++1n=O(logn)\frac{1}{1}+\frac{1}{2}+\dots+\frac{1}{n}=O(\log n)

This implies that if vv iterates over 1n1\sim n, but during each iteration, we only have n/vn/v operations, then the overall time complexity is O(nlogn)O(n\log n).