For any prime number $p$, let $A_p$ be the set of integers $d\in \{1,2,\dots, 999\}$ such that the power of $p$ in the prime factorization of $d$ is odd. Then what is the cardinality of $A_p$?
I have used to the following result, but failed to show the required result.
The largest exponent $e$ of a prime $p$ such that $p^e$ is a divisor of $n!$ is given by
$$
e=\left\lfloor \dfrac{n}{p} \right\rfloor +
\left\lfloor \dfrac{n}{p^2} \right\rfloor +
\left\lfloor \dfrac{n}{p^3} \right\rfloor
$$
How can I do next?
The number of integers less than or equal to $n$ and divisible by $d$ is $\lfloor n/d \rfloor $. You need to count the number of integers divisible by $p$, minus the number of primes divisible by $p^2$, and so on...