# Contest Problem

Let N be the set of positive integers whose decimal representation is of the form 4ab4 (for example: 4174 or 4004). If a number x is picked randomly from N, what is the probability that x is divisible by 6, but not divisible by 12?

I got an answer of $\frac{17}{100}$. Could you someone verify that for me.

• Tell us how you got that answer. – TonyK Apr 21 '15 at 15:20
• How do you pick a random element from an infinite set? – Jack D'Aurizio Apr 21 '15 at 15:34
• @JackD'Aurizio with a distribution. But anyway the set is finite--$a,b \in { 1,\ldots,10 }$. I think he's using decimal as base-10. – MichaelChirico Apr 21 '15 at 15:55
• Oh, pardon, my bad, I misread the question. I thought we were dealing with all the positive integer numbers starting and ending with a $4$. – Jack D'Aurizio Apr 21 '15 at 16:00

$N$ has $100$ members.
Every member $x$ of $N$ is divisible by $2$; it is divisible by $3$ (and therefore by $6$) iff $a+b \equiv 1 \mod 3$. Of these, $x$ is divisible by $12$ iff $b$ is even. There are three cases $(b = 3, 5, 9$) with $b$ odd and three possible $a$'s ($a = 1,4, 7$ for $b = 3$ or $9$, $a = 2,5,8$ for $b=5$), and two ($b = 1, 7$) with $b$ odd and four possible $a$'s ($a = 0, 3, 6, 9$), for a total of $3 \times 3 + 2 \times 4 = 17$.
So the probability is indeed $17/100$.
Let's see. We'll see if we fix the value of $b$, what all values can $a$ take.
$$0,3,6,9 - 1,4,7$$ $$1,4,7 - 0,3,6,9$$ $$2,5,8 - 2,5,8$$
Thus, $3*4 + 4*3 + 3*3 = 33$ possible pairs for $x$ to be divisible by 6. (if $b$ takes any of the values on the left hand side, then $a$ must take a value from the corresponding right hand side if $x$ is to be divisible by 6.) For $x$ to be divisible by 12, b should either be 0,2,4,6,8. This leave us with only $33 - 16 = 17$ pairs. There are total $10*10=100$ ways of choosing $a$ and $b$ (i.e. the size of $N$ is $100$). Thus the required probability is indeed $\frac{17}{100}$. So, I guess you are right.