Problems > Distinct Prime Factors > Editorial

Distinct Prime Factors — Solution & Editorial

Back to the Problem

Factorize by trial division to √N and count distinct primes found (plus the leftover prime, if any).

Complexity: O(√N)