How many positive integers less than or equal to $500$ have exactly $3$ positive divisors? 
How many positive integers less than or equal to $500$ have exactly $3$ positive divisors?

My approach was to use the following inequality $N \leqslant 500$, where $N$ is the number of positive integers that have exactly $3$ positive divisors. Prime factorizing $500$ one would get that $500 = 2^2 \cdot 5^3$. Wouldn't this imply that $N$ would have to be of the form $N = 2^a \cdot 5^b$ and from the given condition we would get that $(a+1)(b+1) = 3$? However I couldn't get this any further. Any tips would be appreciated.
 A: For $n$ to have exactly $3$ positive divisors, $1$ must be a factor, $n$ must be a factor and also we need another factor say $p$.
We need $\frac{n}{p}=p$ and $p$ is a prime. Prime is needed or additional divisors exists.
Hence $n$ must be a prime square.
Since $\sqrt{500}\approx 22.3$, the numbers are $2^2, 3^2, 5^2, 7^2, 11^2, 13^2, 17^2, 19^2$.
A: A number has exactly 3 positive divisors iff it is of the form $p^2$ where $p$ is prime. The following are $<500$: 4, 9, 25, 49, 121, 169, 289, 361 (8 numbers).
A: There is no need to prime factorize $500$. The number of divisors of an integer $n$ is given by $$\prod_{i=1}^k (e_i+1)$$ where $n = \prod_{i=1}^k p_i^{e_i}$ (i.e. the prime factorization). It is then easy to see that the only way $n$ would have exactly $3$ positive divisors is if $n = p^2$ with $p$ prime.
Then the problem reduces to finding the number of $n = p^2 \le 500 \to p \le \sqrt{500} \approx 22.4$. There are $8$ primes less than or equal to $22$: $ 2, 3, 5, 7, 11, 13, 17, 19$. Therefore, the answer is $8$.
