Groups
Category
A sqrt tree is a layered block-decomposition data structure that answers range queries in O(1) time after O(n \log \log n) preprocessing.
The Harmonic Lemma says that the values of \lfloor n/i \rfloor only change about 2\sqrt{n} times, so you can iterate those value blocks in O(\sqrt{n}) instead of O(n).