Probability divisibility test

If a 9 9 digit number is formed using the digits 1 1 to 9 9 without repitition and if the probability that they will be divisible by 11 11 is p q \frac{p}{q} , then find p + q p+q

where p a n d q p~and~q are co prime natural numbers


The answer is 137.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Akash Gaonkar
May 31, 2015

There are 9! different combinations of the 9 digits, or 362880 possibilities. This can easily be churned through by a computer.

Python 3.1 code:

from itertools import permutations
from fractions import Fraction

def to_num(iterable):
    val = next(iterable, None)
    return 0 if val == None else val + 10 * to_num(iterable)

p, q = 0, 0

for digits in permutations(range(1, 10)):
    if to_num(reversed(digits)) % 11 == 0: p += 1
    q += 1

print(Fraction(p, q))

This prints "11/126" which sums to 137.

Quite a short code there (y)

Anubhav Balodhi - 5 years, 11 months ago
Saya Suka
May 18, 2019

1+2+3+4+5+6+7+8+9 = 45. To get a nine non-zero distinct digits number which is also divisible by eleven, we need the difference of odd and even placing of digits to be a multiple of 11. 45 is odd, so the difference cannot be zero nor it any more than 11, or else we have to find at least four non-zero distinct digits to add up to as low as (45-3x11)/2 = 6, which is impossible (1+2+3+4 = 10). If the even-odd difference be 11, then the lesser side should sum at (45-11)/2 = 17.
17 = 1+2+3+4+7.
= 1+2+3+5+6.
= 1+2+5+9.
= 1+2+6+8.
= 1+3+4+9.
= 1+3+5+8.
= 1+3+6+7.
= 1+4+5+7.
= 2+3+4+8.
= 2+3+5+7.
= 2+4+5+6.
So as listed above, there are eleven ways to do groupings, with the former two forming the odd placing and latter nine the even ones.
P(divisible by 11).
= (11 groupings) (5! of odd placing) (4! of even placing) / (9! total freedom of digits placing).
= 11/126



Aditya Chauhan
Sep 19, 2016

Let the sum of the digits at even places be x x and sum of digits at odd places be y y .

Then x + y = 45 x+y=45

For the number to be divisible by 11 , x y = 11 z x-y = 11z where z is an integer. z z can be 1 or -1.

Possible values are ( x , y ) = ( 17 , 28 ) , ( 28 , 17 ) (x,y)=(17,28),(28,17)

Number of such x x and y y can be calculated and comes out to be 11.

Therefore Probability = 4 ! × 5 ! × 11 9 ! \dfrac{4!\times5!\times11}{9!} = 11 126 \dfrac{11}{126}

p + q = 137 p+q= \boxed{137}

Siddharth Iyer
Aug 15, 2015

The result is (11*(4!)(5!))/(9!)

Anubhav Balodhi
Jul 1, 2015

The sample space can be easily found out: 9!

Now for the favourable cases, the divisibility test of 11 is: the difference of ( sum of digits at even places and sum of digits at odd places) must be divisible by 11:

And since the 9! < 10^6. We can do it by a program.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#AnubhavBalodhi, Brilliant, level 5 in Combinatronics, Probability divisibility test
import itertools
from math import factorial
from fractions import Fraction
array=list(range(1,10))
for num in array:
    print(num)
A=list(itertools.permutations((array)))
ans=0
for a in A:
    odd=0
    even=0
    i=0
    for num in a:
        if i&1:
            odd+=num
        else:
            even+=num
        i+=1
    if (even-odd)%11 ==0:
        #print(a)
        ans+=1

print(ans)

a=ans
def gcd(a,b):
    if(b==0):return a;
    return gcd(b,a%b);

b=factorial(9)
c=gcd(a,b)
ANS=Fraction(a,b)
ans=int(a/c)+int(b/c)
print(a,b,c,int(a/c),int(b/c),ans,ANS)

It gives ans=137.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...