Probability on divisibility

Let S be the set of all 12-digit positive integers each of whose digits is either 1 or 4 or 7 (for example, 477411171747 is a member of S). What is the probability that a randomly picked member of S is divisible by 12 ?

HINT:

For a number to be divisible by twelve it must be divisible by $4$ and $3$.

Also the divisibility rule for a number to be divisible by $4$ is that its last two digits must be divisible by four.

Also for three is that its sum of digits is a multiple of $3$.

Can you take it from here?

Hint 1: A number is divisible by $12$ if and only if the sum of its digits is divisible by $3$, and the last two digits are divisible by $4$.

Hint 2: $1,4,7$ are all congruent to $1 \pmod 3.$

Thanks for the hint.

So, 11 cannot be divisible by 4 and 77 cannot be divisible by 4 means the last two digits should be 44.

Further 1 = 1 (mod 3), 4 = 1 (mod 3) and 7 = 1 (mod 3) then any combination of 12 digit numbers of 1, 4, 7 and its sum will be 0 ( mod 3).

Then coming to the crux of the problem, No of number 12 digit numbers with 1, 4 and 7 is 3^12 ( with repetition allowed) goes to the denominator and No of 12 digit numbers with 44 as the last two digits is 3^10 goes to the numerator

Thus the required probability is 3^10/3^12 = 1/9.

Thanks guys for the hints and just let me know that this correct.

• Last two digits could be 17 or 71 as well. – Casteels Oct 29 '13 at 11:26
• @Casteels Does that contradict what you said in your answer? – Tunococ Oct 29 '13 at 11:29
• Oh oops of course, sorry I was thinking the sum, not the actual last two. Thanks. – Casteels Oct 29 '13 at 11:32
• Yes. Your answer is correct. Fixing the last two digits as '44' makes you h=job easy. – lsp Oct 29 '13 at 11:36
• That means of the last two combinations of 11,14,17,41,44,47,77,71,74 there are 3 that works and six that do not work. Means the numerator = 3^11 and hence the probability is 1/3 I guess. – Satish Ramanathan Oct 29 '13 at 11:37