Question :
How many numbers less than $50000$ can be formed which are multiples $6$ using the digits $0,1,2,3,4,5$?
My attempt :
First of all, for a number to be a multiple of $6$, it should be a multiple of $2$ as well as $3$. So, the number must be even as well as it's sum of digits should be a multiple of $3$. Next, the number should have only the digits $1,2,3,4$ in the first position as it has to be less that $50000$. But, I face a problem, If I put $2$ or $4$ in the first position, then I will have one less even digit for the last position and there would be cases where I only use the digits $0,1,2,4,5$ or $1,2,3,4,5$ so as to make the number divisible by $3$. So, is there an efficient way to cover all the cases and get the answer quickly?
All help will be appreciated.
I assume leading zeros are not allowed, but you can adapt this if they are.
If you have to use the digits once each, the one you don't use has to be $0$ or $3$ to get a multiple of $3$. Then you just need a permutation where the ones digit is even and the first digit is not zero. I would choose which digit is missing, condition on whether the first digit is even or odd, then count the ways to choose the ones digit, then the number of ways to choose each other digit.
If you can use the digits multiple times, choose the ones digit as an even, choose the first digit as non-zero, choose three others as anything, then note that you have two choices for the last digit to make the multiple of $3$ come out right.