Search
⌘K

Leetcode 3233. Find the Count of Numbers Which Are Not Special

Count how many integers in [l, r] are not "special", where a "special" number has exactly two proper divisors — equivalently, it is a prime square (has exactly three total divisors). So the answer is (r−l+1) minus the number of primes p with p^2 in [l, r] (i.e., primes in [ceil(sqrt(l)), floor(sqrt(r))]).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.