AB * CD = BA * DC

We know that the order of digits in a number matter, and we cannot randomly swap them around. Most of the time,

A B × C D B A × D C . \overline{AB} \times \overline{CD} \neq \overline{BA} \times \overline{DC} .

How many ordered tuples of non-zero digits ( A , B , C , D ) (A, B, C, D) are there such that

A B × C D = B A × D C ? \overline{AB} \times \overline{CD} = \overline{BA} \times \overline{DC} ?


The answer is 209.

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.

2 solutions

Caleb Townsend
Feb 6, 2015

Java solution:

int numSolutions = 0;
for (int a = 1; a < 10; a++)
    for (int b = 1; b < 10; b++)
        for (int c = 1; c < 10; c++)
            for (int d = 1; d < 10; d++)
                if ((10*a + b)*(10*c + d) == (10*b + a) * (10*d + c))
                    numSolutions++;
System.out.println(numSolutions);

Note that the if statement simply checks if A B × C D = B A × D C . \overline{AB} \times \overline{CD} = \overline{BA} \times \overline{DC}. Sure enough, the program says it's 209.

Calvin Lin Staff
Feb 2, 2015

This solution is incorrect as I missed out several cases. See the report forum for correct solutions.

(Solution deleted)

We also have cases where a=b and c=d

vinod kumar - 6 years, 4 months ago

Log in to reply

Thanks. As it turns out, I missed out a lot of cases. Sorry about that. I have updated the answer to 209

Calvin Lin Staff - 6 years, 4 months ago

Here is how I solved it.

If we write the decimal expansion of the equation, we get

( 10 A + B ) ( 10 C + D ) = ( 10 B + A ) ( 10 D + C ) (10A + B)(10C + D) = (10B + A)(10D + C)

Simplifying this gives A × C = B × D A\times C = B\times D

I then listed all the possible products A × C A \times C , where A A and C C are from 1 to 9.

These products can be divided into 4 cases

Case 1. A × C A \times C can only be written as a product of two same numbers ONLY.

We see that the following numbers satisfy this case

1. 1 1 1 × 1 1 \times 1
2. 25 25 5 × 5 5 \times 5
3. 49 49 7 × 7 7 \times 7
4. 64 64 8 × 8 8 \times 8
5. 81 81 9 × 9 9 \times 9

There is exactly one ordered tuple for each number (for example ( 1 , 1 , 1 , 1 ) (1,1,1,1) ) and since there are 5 numbers in this case, there are 5 × 1 = 5 5 \times 1 = 5 ordered tuples.


Case 2 A × C A \times C can only be written as a product of two distinct digits

1. 2 2 1 × 2 1 \times 2
2. 3 3 1 × 3 1 \times 3
3. 5 5 1 × 5 1 \times 5
4. 7 7 1 × 7 1 \times 7
5. 10 10 2 × 5 2 \times 5
6. 14 14 2 × 7 2 \times 7
7. 15 15 3 × 5 3 \times 5
8. 20 20 4 × 5 4 \times 5
9. 21 21 3 × 7 3 \times 7
10. 27 27 3 × 9 3 \times 9
11. 28 28 4 × 7 4 \times 7
12. 30 30 5 × 6 5 \times 6
13. 32 32 4 × 8 4 \times 8
14. 35 35 5 × 7 5 \times 7
15. 40 40 5 × 8 5 \times 8
16. 42 42 6 × 7 6 \times 7
17. 45 45 5 × 9 5 \times 9
18. 48 48 6 × 8 6 \times 8
19. 54 54 6 × 9 6 \times 9
20. 56 56 7 × 8 7 \times 8
21. 63 63 7 × 9 7 \times 9
22. 72 72 8 × 9 8 \times 9

For each number, we have 4 possible ordered tuples, (since there are 2! permutations of ( A , C ) (A,C) and 2! permuations of ( B , D ) (B,D) ), and since there are 22 numbers, the total number of tuples = 22 × 4 = 88 22 \times 4 = 88


Case 3 A × C A \times C can be written as a product of two same digits OR a product of two different digits.

1. 4 4 1 × 4 1 \times 4 2 × 2 2 \times 2
2. 9 9 1 × 9 1 \times 9 3 × 3 3 \times 3
3. 16 16 2 × 8 2 \times 8 4 × 4 4 \times 4
4. 36 36 4 × 9 4 \times 9 6 × 6 6 \times 6

For each number there are 9 possible tuples, ( ( A , C ) (A,C) and ( B , D ) (B,D) both have 3 choices each) therefore total tuples = 4 × 9 = 36 4 \times 9 = 36


Case 4 A × C A \times C can be written as a product of two different digits in two ways.

1. 6 6 1 × 6 1 \times 6 2 × 3 2 \times 3
2. 8 8 1 × 8 1 \times 8 2 × 4 2 \times 4
3. 12 12 2 × 6 2 \times 6 3 × 4 3 \times 4
4. 18 18 2 × 9 2 \times 9 3 × 6 3 \times 6
5. 24 24 3 × 8 3 \times 8 4 × 6 4 \times 6

For each number there are 16 possible tuples, ( ( A , C ) (A,C) and ( B , D ) (B,D) both have 4 choices each) therefore total tuples = 5 × 16 = 80 5 \times 16 = 80


Adding all of them gives, 5 + 88 + 36 + 80 = 209 5 + 88 + 36 + 80 = \boxed{209}

Pranshu Gaba - 6 years, 4 months ago

Log in to reply

The first 2 cases are all trivial. the next 2 cases provide 14 sets of tuples.

12 X 42 =21 X 24 // 13 X 92 =31 X 29 //24 X 84 =42 X 48 //46 X 96 =64 X 69

12 X 63 = 21 X 36// 13 X 62 =31 X 26// 12 X 84 =21 X 48 //14 X 82 =41 X 28

23 X 64 =32 X 46// 24 X 63 =42 X 36//23 X 96 =32 X 69 //29 X 36 = 92 X 63

34 X 86 =43 X 68// 36 X 84 = 63 X 48 //All these are distinct number sets.

Brahmam Meka - 6 years, 4 months ago

I think A=D ,B=C SOLutions are not correct

Brahmam Meka - 6 years, 4 months ago

Log in to reply

AB X CD = BA X DC (10 A + B ) X (10 C +D) =(10 B + A)(10 D + C) 100 A C + 10 (AD +BC) + B D = 100 B D + 10(BC +AD) +A C 99 A C = 99 B D A C = B D 1 X6 = 2 X3 = 3X2 12 X63 =21 X 36 13 X62 = 31 X26 1X4 =2 X2 12X 42 =21 X24 1 X8 = 2 X4 = 4 X2 12 X 84 =21 X 48 14 X82 =41 X 28

like that we can write for

2 X6 = 3 X4 = 4 X3 2 X8 =4 X4 3 X 6 = 2X 9 = 9 X2 4 X6 =3 X8 =8 X3 etc. they give different pairs.

Brahmam Meka - 6 years, 4 months ago

Log in to reply

Right. my solution is incorrect. Let me completely remove it. I was doing this problem in a daze, and didn't work through it completely.

Calvin Lin Staff - 6 years, 4 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...