Problems > The K-th Squarefree Number > Editorial

The K-th Squarefree Number — Solution & Editorial

Back to the Problem

The count of squarefree numbers ≤ x is ∑d μ(d)⌊x/d²⌋, computable in O(√x) with a precomputed Möbius sieve. Binary search for the smallest x whose count reaches K.

Complexity: O(√x log)