In the wiki article for Legendre's formula see here, it is said the formula is for prime number, but after reading this simply amazing explanation of the formula in this mse post, I think that it can be used for knowing how many times a composite number goes into another number. For example, consider the number of times $4$ goes into 5!, it is given as:
$$ \lfloor \frac{5}{4} \rfloor$$
Which is one, and is exactly the number of times $4$ is a factor of the above. Does this always work or am I missing something?