Double Cryptogram

Logic Level 5

a b c d + b c d a 0 d c b a + c b a d 0 \large{\begin{array}{cccccc} & & & a & b & c&d\\ +& & & b & c & d & a \\ \hline && & & & & \phantom0&\\ \end{array}} \qquad \qquad \large{\begin{array}{cccccc} & & & d & c & b &a \\ +& & & c& b & a & d \\ \hline && & & & \phantom0 &\\ \end{array}}

If a , b , c a,b,c and d d are distinct single-digit positive integers so that the result of both additions is the same, find the number of possible quadruples ( a , b , c , d ) (a,b,c,d) .


See a harder version of this problem .


The answer is 272.

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

Zk Lin
Feb 7, 2016

From the conditions of the problem, c + d = a + b c+d=a+b . We need to find ways of writing integers from 5 5 to 15 15 as sum of 2 2 distinct positive integers in 2 2 distinct ways.

To justify the lower bound of the sum as 5 5 , note that 5 5 is the first integer which can be expressed as sum of 2 2 distinct positive integers in 2 2 distinct ways. We can write 4 4 as 1 + 3 1+3 or 2 + 2 2+2 , but the latter is not allowed since the two integers must be distinct. Similarly, the upper bound of the sum is 15 15 . There is only one way to express 16 16 as sum of two distinct positive integers, that is 9 + 7 9+7 .

Below are the ways of writing 5 , , 15 5, \cdots , 15 as sum of two distinct positive integers.

5 = 1 + 4 = 2 + 3 5=1+4=2+3

6 = 1 + 5 = 2 + 4 6=1+5=2+4

7 = 1 + 6 = 2 + 5 = 3 + 4 7=1+6=2+5=3+4

8 = 1 + 7 = 2 + 6 = 3 + 5 8=1+7=2+6=3+5

9 = 1 + 8 = 2 + 7 = 3 + 6 = 4 + 5 9=1+8=2+7=3+6=4+5

10 = 1 + 9 = 2 + 8 = 3 + 7 = 4 + 6 10=1+9=2+8=3+7=4+6

11 = 2 + 9 = 3 + 8 = 4 + 7 = 5 + 6 11=2+9=3+8=4+7=5+6

12 = 3 + 9 = 4 + 8 = 5 + 7 12=3+9=4+8=5+7

13 = 4 + 9 = 5 + 8 = 6 + 7 13=4+9=5+8=6+7

14 = 5 + 9 = 6 + 8 14=5+9=6+8

15 = 6 + 9 = 7 + 8 15=6+9=7+8

Let n n number of possible ways to write a certain integer as sum of 2 2 distinct positive integers. To enumerate the number of quadruples ( a , b , c , d ) (a,b,c,d) , we take 8 ( n 2 ) 8\displaystyle \sum_{} {n \choose 2} .

The factor of 8 8 is introduced to account for permutations. Note that ( a , b ) (a,b) is interchangeable with ( c , d ) (c,d) and the elements in ( a , b ) (a,b) and ( c , d ) (c,d) themselves are interchangeable.

A quick computation yields the answer.

8 ( 4. ( 2 2 ) + 4. ( 3 2 ) + 3. ( 4 2 ) ) = 8 ( 34 ) = 272 8(4. {2 \choose 2} +4. {3\choose 2}+ 3. {4 \choose 2}) = 8(34)= \boxed{272}

Moderator note:

Good clear explanation of how to do the counting.

I don't think there is an easy way to do so, other than splitting it up into the cases as listed above.

Exactly same solution that I intended.

Nihar Mahajan - 5 years, 4 months ago
Soumava Pal
Feb 16, 2016

Here is my code in python.

I used short and concise python code:

1
2
3
4
5
6
7
count = 0
for a,b,c,d in permutations('0123456789',4):
  if '0' in (a,b,c,d):
    continue
  if int(a+b+c+d)+int(b+c+d+a)==int(d+c+b+a)+int(c+b+a+d):
    count+=1
    print(a,b,c,d,count)

Anonymous1 Assassin - 4 months, 3 weeks ago
Viet Ký
Oct 24, 2015

I use this JS code (paste it in Chrome Console)

How to do this

Akhil Krishna - 5 years, 7 months ago

Log in to reply

This code uses recursive to find all permutation from 1 to 4 then for each set we check the condition and increase the count. There are some methods in Python to find permutation but since I don't have Python installed, I use JS. Anyways, it's cheating :).

Viet Ký - 5 years, 7 months ago

Well, another way is to observe that c + d = b + a c+d=b+a

Julian Poon - 5 years, 7 months ago

Log in to reply

Ah, then the code would be shorter (jk). Actually, I'd had this code before I got this problem so I just modified a bit to solve this problem :). But, what's next? How could we get the result with that observation? Could you post a full answer please?

Viet Ký - 5 years, 7 months ago

Log in to reply

After that it's sort of combinatorics. I'm too lazy to post a solution though. But basically, you find the number of solutions to a + b = c + d = k a+b=c+d=k from k = 2 k=2 to k = 17 k=17

Julian Poon - 5 years, 7 months ago

Log in to reply

@Julian Poon Same Method

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni Post it as solution. Please

Dev Sharma - 5 years, 7 months ago

Log in to reply

@Dev Sharma I am an extremely lazy person once it comes to writing a solution. I know you must have got a+b=c+d. Then the value of a+b ranges from 3 to 17 so I found all possible quadrules in this way, it took me some time to do that and I hope you can easily do it.

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni yes. I found a+b=c+d but cant do after. I would try...

One message. Dont u use fb regularly?

Dev Sharma - 5 years, 7 months ago

Log in to reply

@Dev Sharma No I don't open it regularly

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni I think you have solved this problem many days before. But how do you know solution has been provided?

Dev Sharma - 5 years, 7 months ago

Log in to reply

@Dev Sharma I open the problems I like and reshare everyday once to see if anyone has written a solution

Kushagra Sahni - 5 years, 7 months ago

@Dev Sharma Even I don't have a formal method to do that. But it is possible to count them manually :) This is only my solution.

Nihar Mahajan - 5 years, 7 months ago

Log in to reply

@Nihar Mahajan Why did you delete your solution in Priyanshu Mishra's question when we had a little chat?

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni I realized my mistake which was pointed by Ivan Koswara. To avoid further misconception , I preferred deleting it. Sorry for the inconvenience caused :(

Nihar Mahajan - 5 years, 7 months ago

Log in to reply

@Nihar Mahajan I also pointed out a mistake. Was I correct?

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni I don't know. But my mistake was definitely different than the thing pointed by you.

Nihar Mahajan - 5 years, 7 months ago

@Julian Poon Value of k can't be 2 because a,b,c,d are distinct. It is altleast 3 and at max 17.

Kushagra Sahni - 5 years, 7 months ago

Log in to reply

@Kushagra Sahni Opps, typo

Julian Poon - 5 years, 7 months ago

Yes. I manually counted few and the rest with symmetry :)

Nihar Mahajan - 5 years, 7 months ago
Bhaskar Pandey
Jun 1, 2021
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
count=0
for a in range(1,10):
    for b in range(1,10):
        if a==b:
            continue
        for d in range(1,10):
            if d==b or d==a or (2*d==a+b) or ((a+b-d) not in range(1,10)):
                continue
            count += 1

print(count)

I used this python 3 code:

ans=0
for a in range(1,10):
    for b in range(1,10):
        for c in range(1,10):
            for d in range(1,10):
                if 1000*a+100*b+10*c+d+1000*b+100*c+10*d+a==1000*d+100*c+10*b+a+1000*c+100*b+10*a+d and a!=b and b!=c and c!=d and a!=d and b!=d and a!=c:
                    ans+=1
                else:
                    pass
print (ans)

I used the same python code

Leslie Koller - 5 years, 4 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...