If you reverse all the digits of a positive integer, is it ever possible for the resulting number to be twice the original number?
Hint: You can approach this like a cryptogram puzzle ; with three digits you would solve A B C + A B C = C B A where each letter represents a digit.
Note: The problem is done in base 10.
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.
This is easily generalizable into the full problem, because the value of B was irrelevant to the argument. That is, we could write
A...C A...C + C...A
where . . . indicates some arbitrary fixed number of digits. Then the argument above applies to any positive integer we attempt to reverse the digits on.
Very nice solution!
PROBLEM: If you reverse all the digits of a positive integer, is it ever possible for the resulting number to be twice the original number?
ANSWER: Are 111, 222, 333 and 444 "positive integers"? Yes! Nowhere in the problem statement does it state that the three digits must be unique. Therefore the answer is YES, since 111+111=222, 222+222=444, 333+333=666 and 444+444=888.
Log in to reply
The numbers ought to be flipped, so the result of flipping 111 would still be 111 and that's not twice of its original number
Log in to reply
No, but 2x0=0
Excellent! Another example.
I read the problem incorrectly. I realized this shortly after posting the above reply but there's no way to remove or edit posts. I appreciate Joey Xiang's polite response to my mistake. In the future I'll take the time to read problem statements more carefully!
111+111=222 which is 2 times 111 and 111 is the reverse of 111
Log in to reply
Let's pick 111 as our number. Now, reverse the digits. The result is 111. Is 111 twice as large as 111? No. Therefore 111 isn't a solution.
Are solutions restricted to base-10 integers? There are certainly base-2 solutions if you allow leading zeroes. (01 reversed is 10)
We also know that B+B is in {B, 10+B} if A<5 and {B-1, 10+B-1} if A>=5. So => Bis in {0 , 9} since 0+0=0 and 9+9=18+1 =10+B-1
In base 2, the number 10 = 2[in base 10] x 01.
Ipso facto, the answer is ‘yes’, not ‘no’.
What if the digits are 1, 1, and 1?
Log in to reply
Then when you reverse the digits, you don't get double the original number. Additionally, when A = 1, B = 1, and C = 1, it is untrue that 111 + 111 = 111.
There are however many instances where the reversal of digits results is more than twice the original integer, but not exactly twice the original integer. (Almost any integer where C is more than twice A in A...C)
Why must A be < or = 4? If the answer is NO then A can be any number. If the proof was for an answer of YES then restrictions might apply, but since the answer is NO, then it matters not hat integer you choose to test.
Log in to reply
Because there would be a carry of 1, and the result would have more digits than the starting number.
Well there are cases like 111 or 222 or 333 or 444 where it can be double when its reverse is summed up. There is no where mentioned that digits are to be distinct
Log in to reply
You need the reverse itself to equal double the number, no summing.
Log in to reply
That's the point! They don't got it.
I concur. I was initially thinking 404; 404 + 404 = 808.
I tried this problem using the number 123, and no matter what, it wasn't possible to get double the number. I would rate this problem a 1 because it was simple to figure out.
Log in to reply
Unless you tried each and every positive number (it doesn't say it has to be a 3 digit number), you wouldn't be able to figure that out using your method (of multiplying and checking). Just because you are ignorant doesn't mean you can just say that it is "simple to figure out"
@Mark Perera is correct that this isn't a proof of the problem. (Please be polite, though - we're all learning here!)
Starting with specific cases can be a good way to think of things, though. Sometimes you can almost directly transition from numbers into variables to make the problem general, although here you do need to think of all cases for the first and last digit for this to work.
∞. If ∞ is reversed, go get an infinite number. and, ∞ squared is equal to ∞. so, the reverse of ∞ is equal to ∞. The answer, yes.
Log in to reply
I think this is a joke but in case it isn't, you cannot treat ∞ as a number because it is not a number.
"Since CBA has 3 digits, A must be less than or equal to4. A must also be even, because 2 multiplied by ABC is even. Combine these two facts, and A has to be either 2 or 4."
but why can't A be equal to 0?
Log in to reply
What are you proposing as the value of C, then?
You can't have 0B0 because reversing the digits needs to be twice the original number.
Suppose such a number existed and we tried generating it. We know that a 1 < 5 and that obviously 2 a 1 is an even digit. For the reversed integer to correspond to the original integer, the first digit of the reversed integer must be even. Since a digit greater than or equal to 5 would carry-over at most a 1 and 2 a 1 + 1 is odd, it follows that a 2 < 5 . Now generalizing and using the same logic, we can deduce that a 1 , a 2 , a 3 , a 4 , ⋯ , a n − 1 , a n < 5 and thus there will be no carry over when the original integer is multiplied by 2 . Now that we have established this, we can pair each digit in the normal integer to a digit in the reversed integer as such:
a 1 → a n
a 2 → a n − 1
a 3 → a n − 2
⋮
If we now consider just a 1 and a n , because of the position of the first digits of both the original and the reversed number, it follows that 2 a 1 = a n . For the same reason, because of the position of the last digits of both the original and the reversed number, it follows that 2 a n = a 1 . However we previously stated that 2 a 1 = a n and as a result 2 a n = a 1 unless a 1 , a n = 0 which cant be possible because you cannot begin writing an integer with the digit 0 . As a result, there is no number such that if you reverse the digits of said number, the resulting integer is equal to the original number multiplied by two and the answer is No .
You can use n a 1 a 2 ⋯ a n instead of a b c ⋯ x y z
Log in to reply
Hahaha I don't know why I didn't think of that. Many thanks
Log in to reply
Just a note, I know it's a bit pedantic but there are n+1 digits in the number a 0 . . . a n . If you were to change it, I would just suggest removing a 0
Log in to reply
@Stephen Mellor – Thanks for pointing that out. By the way, no worries it's not pedantic, being consistent is important.
Log in to reply
@Piero Sarti – It improves your problem and solution so you're welcome
I'm not sure it follows 2an= a1 and 2a1=an because of the carry-over on both the first and final digit(first receiving it and the final passing it on). The answer is still the same though, a1={1,2,3,4} so an= {0,2,5,6,7} and by elimination, we find that there is not an "an" that satisfies the requirements.
Log in to reply
If any digit in the number were greater than or equal to 5 , then the resulting integer would have more than n digits when multiplied by 2 . Therefore a 1 , a 2 , a 3 ⋯ a n ∈ 0 , 1 , 2 , 3 , 4
Log in to reply
Not any digit, only the first digit has that constraint that's why "a1" has to be {1,2,3,4} and consequently "an"= {0,2,5,6,7} e.g 7+7 would result in 4 in the last place of the sum which corresponds to the value of a1 which is less than 5. But my point is 2an= a1 and 2a1=an doesn't follow because of the carry-over.
Log in to reply
@Daniel Hernandez – Good point. There is actually another way you can prove that all digits have to be less than 5 . I will update the solution with this method of proof.
Hey suppose the number is 111 or 222 or 333 in that case it is possible
Log in to reply
In all those numbers the reverse would be the same number, the only case of a number being twice the same number is 0 which is not positive.
When you say "2a1 = an and 2an = a1, so that is a contradiction" i think you have to say that this only happens with an = a1 = 0, because in this case it wouldn't be a contradiction. (The statement says positive integer, so this case is eliminated).
Why 0 is not a valid solution ? Since we are dealing with positive integers, and not strictly positive ones, and that 0 is both negative and positive (at least in typical French mathematical usage) ? Moreover, I don't see why might 000 not be a valid way of writing 0, since we are just ignoring leading zero in positional notation ?
Log in to reply
Ignoring the position of the zero, changes the number itself. You cannot tack off digits from the number.
I think that your initial hypothesis about all the digits of the hypothetical number being less than 5, is not correct. It is supposed to be true because the length of the number cannot increase after the sum. But if you consider carring-over you get that (for example) 437+437 = 874 that is still of 3 digits. Considering the number a 1 a 2 a 3 ⋯ a n − 1 a n , only a 1 has the constraint of being less then 5. a n can have bigger values so we have, with a carry-over, the possibility of 2 a n − 1 0 = a 1 and 2 a n − 1 + 1 = a 2 .
Log in to reply
I have updated my solution to explain why all digits must be less than 5 .
111 + 111 = 222
Log in to reply
1 1 1 reversed is not 2 2 2 . You need to reverse the digits.
using this approach I did the following: since 2 a i + c i = a n − i + c i + 1 , 2 a n + c n = a 0 + c 0 , with c 0 = 0 you can write the problem as a matrix multiplication equation
( 2 I n − f l i p ( I n ) ) A = ( I n − m o v e d ( I n ) ) C
where A = [ a 0 , . . . , a n ] or digits vector, C = [ c 0 = 0 , c 1 . . . , c n ] or carries vector, I n = identity matrix of size n , f l i p ( I n ) is fliped identity matrix along vertical axis which allow to get the a n − i term and m o v e d ( I n ) is the matrix needed to get c i + 1 term on equation when applied to C f l i p ( I n ) = ⎣ ⎡ 1 ⋱ 1 ⎦ ⎤ m o v e d ( I n ) = [ 0 n − 1 , 1 1 I n − 1 0 1 , n − 1 ] .
Then, we can get A (our number) inverting the matrix on the left side:
A = ( 2 I n − f l i p ( I n ) ) − 1 ( I n − m o v e d ( I n ) ) C
I dont plan to obtain a solution rather I want to prove that no integer solution could be found (since we need an integer solution for every a i ). Let me call M n = ( 2 I n − f l i p ( I n ) ) . This matrix has an specific form for odd and even values of n .
n o d d , M n = ⎣ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎡ 2 0 − 1 ⋱ … ⋱ 2 0 − 1 0 ⋮ 0 1 0 ⋮ 0 − 1 0 2 ⋱ … ⋱ − 1 0 2 ⎦ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎤
n e v e n , M n = ⎣ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎡ 2 − 1 ⋱ ⋱ 2 − 1 − 1 2 ⋱ ⋱ − 1 2 ⎦ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎤
What I want to do is to prove that M n − 1 is something like M n − 1 = q ∗ G n with G n ∈ Z and q ∈ Q . Using the explicit form of M n is not hard to check that M n − 1 = 3 1 ( 4 I n − M n ) (which I found out by testing for different values of n, then proved using M n M n − 1 = I n ). This means that
A = 3 1 ( 2 I n + f l i p ( I n ) ) ( I n − m o v e d ( I n ) ) C
All the terms of this equations are integer matrices
C (carry over) can only have 0 s or 1 s. ( I n − m o v e d ( I n ) ) has only 0 s, 1 s and − 1 s ( 2 I n + f l i p ( I n ) ) has only 0 s, 1 s, 2 s and − 1 s
so ( 2 I n + f l i p ( I n ) ) ( I n − m o v e d ( I n ) ) C has only integer terms but that 1 / 3 at the begining proves that no integer solution is found for A besides trivial solution 0 .
1 2 3 4 5 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
lol, tried it and every successive number took more and more time to execute. Had to terminate the program.
I miss understood the question. I thought it should be more than twise.
ABC
CBA
B:
9+9+1=19
B is "9"
C >5 6,7,8,
A <5 2*C=A
in python: //------------------------------------------------------- for a in range(1,10): for b in range(1,10): for c in range(1,10): if 2 a == c and 2 c-10 == a: print a,c else: print "error" //------------------------------------------------------------- end is 'error'
You have omitted (i) the integer 0, for which the answer is ‘yes’; and (ii) the binary number 01, for which the answer is also ‘yes’. There are probably others too.
Log in to reply
For (i) , 0 is not a positive number, and the OP explicitly talks about reversing a positive number For (ii) I guess you have a point
The fact you tested 10e7 number doesn't prove that there is no integer with more than 7 digits that fits. It only proves that "if the integer exists it's bigger than 10e7". But there is still "IF".
Log in to reply
yes, but its a cool code nevertheless
True, but the pattern is recurring so I imagine it can be inferred for ranges ending > 10e7
Log in to reply
Even if it's recursive and you test 10eN there is always N+1 which you didn't test so it's not prove. You can "feel" you are right and you can even be right but in mathematical terms it's not prove.
I like this one because I'm a programmer and in my head, I wrote a similar program. I did not actually put the time in to write and run it but it followed the same though process. I just guessed the answer after going over a few numbers in my "internal python". I'm not the only one that tries to solve things that way instead of doing mathematical proof. For the untrained mind, the mathematical proof is much harder to do me thinks.
Log in to reply
Truth is I find both mathematical proof and computation incredibly useful. I thought of this problem a few months ago before I wrote it and solved it mathematically. Before I went through the trouble of proving the statement I wanted to check if there were any solutions that we're simply very well hidden so I wrote a little C# program that did just that and set it running. Of course I found no numbers and knew that no matter how many numbers I found that didn't have this property, I would still need to check an infinite amount of other numbers to be sure. However, I think we often overlook how useful computation is in number theory as it helps us feel more sure about a problem or statement.
I think there needs to be a caveat in the statement that all the numbers can't be the same, because it actually works for all numbers that are the below integer 5; e.g. 11 + 11 = 22, 444 + 444 = 888, etc. but maybe I misunderstood the question.
Log in to reply
I agree with Matt. The question asked regarding a positive intiger with no other mentioned constraints on that value. It only "hinted" towards approaching it with an ABC approach. However, as Matt points out, a solution emerges by taking an AAA approach.
Log in to reply
As I have stated multiple times on this problem the question is different. (e.g. 1 1 reversed is 1 1 and that doesn't equal 2 × 1 1 = 2 2 .
I seem to have over complicated it but solved it using deductions shown below. I started with what the question has hinted for us to start:
ABC + ABC = CBA
Therefore, C+C = XA where X = 1 or 0
This gives B+B+X = YB where Y = 1 or 0
This gives A+A+Y = C
If you calculate all the B+B possibilities, you will find there is no solution where B+B = B if X=0, however if X=1 and you plug in all the possibilities for B where B+B+1 = YB, the only solution that works is when B is 9, so therefore B can only be 9
That means C has to be between 6 -9 to give us a value of X=1 (as 5+5 will give 10 and A cannot be 0).
So we know C+C = 1A and C >=6, when plugging in the numbers leads us to find that A must be 2,4,6 or 8
We also know that as B has to be 9, so we know Y =1, therefore A+A+1 = C. We can use this equation to narrow down our C and A value possibilities
If A = 2, C = 5; C cannot be 5
If A = 4, C = 9
If A = 6, C = 13; C cannot be 13
If A = 8, C = 17; C cannot be 17
We can now try the values for, A = 4, B = 9, C = 9 These values do not work, so it is not possible.
I started the same way - but then just used equations to rule out solutions. Once you find out B can only be nine, you then know you need one carry over from the C+C - hence: C+C = A +10 Similarly, the 9+9+1 creates one carry-over so that A+A+1 = C Easy enough to solve these linear equations, you will just find that C==19/3 and A==8/3, so no solution with 0 to 9 digits - hence no cigar.
I have a question more than a solution:
Any number can be written in terms of its place, i.e. 23 can be written as (2*10 + 3) So any number AB can be written as 10A + B
For 2 digit numbers, the question is: "In what situation will 2(10A+B) = 10B + A". When we drill the above eqn down to a fraction, we get A/B = 8/19.
Since we know that A and B are definitely single digit integers, we will never have a situation when the above ratio can occur (because the denominator is a double digit number). Hence the problem statement is false (since it says "any" number, if it is false for 2 digits, the statement is false period).
Is there a flaw in this reasoning?
You need to generalize the statement above and consider what happens with n digits. I actually made the exact same problem you mentioned a while back it was called Fun Little Problem . The reason you can't say that if it's false for 2 digits, it's false for n digits is because adding more digits will change the place of the last two digits depending on the total length of the number.
Log in to reply
I get you. Will ponder over this further. I seem to have stumbled over the correct answer by accident.
There are a few of them... 111+111=222, 222+222=444,..through.., 444+444=888. It didn't say anything about A,B, or C being unique.
Log in to reply
1 1 1 reversed is not 2 2 2 . The same follows for every other example you gave. There are no numbers of this form.
Let's try to approach this as a numeric puzzle. To do so, we'll assume the initial number X has its digits a 0 , a 1 , a 2 , . . . , a n and hence it can be represented as X = 1 0 0 × a 0 + 1 0 1 × a 1 + 1 0 2 × a 2 + . . . + 1 0 n × a n = i = 0 ∑ n ( 1 0 i × a i ) Except of the first digit (an), all the digits are either one of the numbers 0, 1, 2, ... , 9. The first digit, (an) is either one of the numbers 1, 2, ... , 9. For example, the number 3451 has its digits a 0 = 1 , a 1 = 5 , a 2 = 4 , a 3 = 3 and can be represented as 3 4 5 1 = 1 0 0 × 1 + 1 0 1 × 5 + 1 0 2 × 4 + 1 0 3 × 3 After we swap the digits of the original number X, we'll have the number Y which is represented as Y = 1 0 0 × a n + 1 0 1 × a n − 1 + 1 0 2 × a n − 2 + . . . + 1 0 n × a 0 = i = 0 ∑ n ( 1 0 n − i × a i ) Given the problem definition, we can write down 2 × X = Y 2 × i = 0 ∑ n ( 1 0 i × a i ) = i = 0 ∑ n ( 1 0 n − i × a i ) Transform further this equation: 2 × i = 0 ∑ n ( 1 0 i × a i ) − i = 0 ∑ n ( 1 0 n − i × a i ) = 0 i = 0 ∑ n ( ( 2 × 1 0 i − 1 0 n − i ) × a i ) = 0 Next examine the term being summed, specifically its part in the parentheses: 2 × 1 0 i − 1 0 n − i For all i non equal to n this term is even because both numbers before and after the minus are even. When i is equal to n this term is transformed as: 2 × 1 0 i − 1 0 n − n = 2 × 1 0 i − 1 which is apparently an odd number and has its last digit either 1 (when i=0) or 9 (when i>0). For simplicity, we can omit the case when i=0 (and n=0 too) because it means our original number X has only 1 digit and its inverse number is X as well and the problem definition gives us the equation 2 × X = X which obviously has no positive integer solutions. If we now go back to the equation i = 0 ∑ n ( ( 2 × 1 0 i − 1 0 n − i ) × a i ) = 0 we see that for all i non equal to n we have the products of some even number, as shown above, and the corresponding digit of the original number X. This means all such products are even. The case when i=n gives us the last term of the summation: ( 2 × 1 0 i − 1 ) × a n Here we have the product of two numbers, the first one having its last digit 9, and the second one which can be either one of the digits 1, 2, ... , 9. Such product will give us an odd number. Hence the equation i = 0 ∑ n ( ( 2 × 1 0 i − 1 0 n − i ) × a i ) = 0 represents a summation of n even numbers (when i loops through 0 to n-1) and one odd number (when i equals n). Such summation never results in 0, and hence the equation has no solutions, which consequently means no positive integer numbers can meet the problem definition.
199 A+10 B=98 C, A is even and 2 A<9 so A is 2 or 4. If A is 2, C must be 1 or 6, but If c is 1, 2 A can't be 1, so c is 6, but because A is 2 or 4 ,2 A doesn't end în 6. If A is 4, then C is 8 or 9, but 2*C doesn't end în 4.In conclusion no A,B,C exists.
No!! It's never possible. Because if we look at the no. at position B , it remains unchanged. And in order to be it twice the no. before, it will always be greater than the previous B.
AB1C + AB1C = CBA .
B1+B1= B .
ie B > B1
ABC + ABC = CBA. Given that B is in the same position twice when B is multiplied by 2 the last digit of this two digit number must be B. This shows B > 5 because anything less doesn’t produce a two digit number and therefore couldn’t have this property. None of the numbers 6 - 9 have this property which means that the only possibility for this being true is C produces a two digit number. If C does produce a two digit number C > 5. Using guess and check we find that a 9 X 2 + 1 = 19 which is the only number between 6-9 with this property meaning B has to be 9. It’s then a simple case of checking all the numbers 6 - 9 for C to prove that this property does not exist for any 3 digit number. There’s probably a more elegant solution than that. If there is, add a comment below! I’d love to here it!
Take a number AB (such that AB+AB = BA) => 20A +2B = 10B + 2A => 9A=4B So it is not possible, for A, B both are integers, but if they are not integers they will be unable to make a number
111 digits reversed 111and 111+111=222
Let the original number ( No ) be AB...YZ and the number with reversed digits ( Nr ) be ZY...BA
If Nr is twice No then A (as the last digit of Nr ) must be an even number.
If A=2 then for the doubling to work, Z (as the last digit of No ) would have to be 1 or 6. But 1Y...B2 is clearly less than 2B...Y1 and 6Y...B2 is more than double 2B...Y6. So Z can't be 1 or 6.
If A=4 then for the doubling to work, Z would have to be 2 or 7. But 4B...YZ doubled would have to be either 8Y...BA or 9Y...BA. So Z can't be 2 or 7.
If A=6 or A=8 then No doubled would have more digits than Nr .
And A not = 0 is assumed by the definition of No = AB...YZ
when looking at digits of numbers its easier to write " A B " as " A ∗ 1 0 + B " so you can actually calculate them. I will first prove why this cant work with a two-digit number: 2 ∗ ( A ∗ 1 0 + B ) = B ∗ 1 0 + A equals 2 0 ∗ A + 2 ∗ B = B ∗ 1 0 + A now subtract A from both sides 1 9 ∗ A + 2 ∗ B = B ∗ 1 0 and subtract 2*B from both sides 1 9 ∗ A = B ∗ 8 finally divide by 8 2 . 3 7 5 ∗ A = B and there you have it. whatever the 2nd digit is, the first has to be 2.375 times as much. This is impossible since digits have to be whole numbers.
Looking a bit further at the 3 digit numbers we can quickly see that they cant work either: 2 ∗ ( A ∗ 1 0 0 + B ∗ 1 0 + C ) = C ∗ 1 0 0 + B ∗ 1 0 + A in this case B will just cancel out and we have the same issue again.
I hope I could help since this is the first solution I am writing please comment if anything is unclear or incorrect. Have a nice day!
Let A 1 A 2 . . . . . A n when added with A 1 A 2 . . . . . A n gives A n A n − 1 . . . . . A 1 [WHERE ALL A's ARE SINGLE DIGIT NUMBERS !!!!!] Since the first digit of our result is A n therefore it is greater than A 1 it also follows that A n = 2 A 1 + 1 or 2 A 1 [Since A 2 + A 2 can give at most carry over 1 !!!] ⇒ A n + A n = 10 + A 1 [ SEE THE UNIT DIGIT OF THE NUMBERS ADDED AND THE RESULT !!!] applying the two expressions we got ,the numerical value of A 1 and A n comes out to be non-positive integers !!!! Which contradicts our assumption and therefore the answer is N O
Let a 1 a 2 a 3 . . . a n be a number (with every a i being a digit) such that a n a n − 1 . . . a 1 = ( a 1 a 2 a 3 . . . a n ) ∗ 2 . We must have it that a 1 is the last digit of a n ∗ 2 , but also less than a n . That means that a n cannot be less than 6, since all digits less than 6 are such that the last digit of their product by two is either greater than themselves or zero.
We are left with the options of 6,7,8, and 9 for the value of a n . It can't be 6, because a number that starts with 2 can't be such that its product by two starts with 6. For a similar reason, it can't be 7, (a number that starts with 4 can't be such that its product by 2 starts with 7). It can't be 8 (any number that starts with 6 is such that its product by two starts with 1) and it can't be 9 for the same reason. Therefore, we run out of options, making such a number impossible.
Brute force in python:
1 2 3 4 5 |
|
Since B is symetric, I can write it just as
AC+AC=CA; {A,C∊{0,1,2,3,4,5,6,7,8,9}}.
Now proof:
2AC=CA
2(10A+C)=10C+A
20A+2C=10C+A
20A+2C-2C-A=10C+A-2C-A
19A=8C
A= 8 1 9 C
and that has 0 non-trivial solutions (for given ranges of A,C).
If A B C + A B C = C B A , then either:
C = 2 A or C = 2 A + 1 , depending on whether B > 4 .
As C > A must be true for A B C + A B C to result in a 3-digit number, we can use A = 2 C − 1 0 to solve C by substitution, which gives us either C = 2 0 / 3 or C = 1 9 / 3 respectively. Because neither of these values of C are integers, a solution is not possible.
Doubling an integer is the same as doubling each digit in the integer, carrying a 1 if the result > 9. So for this to work, C = 2A and A = 2C. A = 4A and C = 4C. A = C = 1. The integer is a palindrome, so reversing it does not change its value.
A+A=C. C+C=A. •°•. 2A/2C=C/A
C^2=A^2. HENCE THE ANSWER IS NO
A+A = C or A+A+1=C.
C+C = A or C+C=10 + A.
Your solution would be valid if you can account for the other cases.
No solutions!
from itertools import permutations
for A, B, C in permutations(range(0, 9), 3):
string = str(A) + str(B) + str(C)
value = int(string)
if str(value + value) ≡ string[::-1]:
print(string)
break
Since we're doubling ABC, we have two possibilities:
a. If C is even, then C = 2A.
That would mean that when we add our two numbers together, we're adding C + C = 4A.
Since 2ABC = CBA, 4A must be a number ending in A. So 4A = A, or 4A = A + 10.
4A = A only works if A = 0, which it can't because then we wouldn't be adding three-digit numbers.
So, 4A = A + 10
3A = 10
And that can't happen because A would not be an integer.
b. If C is odd, then C = 2A + 1.
That would mean that when we add our two numbers together, we're adding C + C = 4A + 2.
Since 2ABC = CBA, 4A + 2 must be a number ending in A. So 4A + 2 = A, or 4A + 2 = A + 10.
4A + 2 = A doesn't work because A would be a negative number.
So, 4A + 2 = A + 10
3A = 8
And that can't happen because A would not be an integer.
Let a = A . . . Z , z = Z . . A and let's assume 2 a = z
Clearly comparing the first digit must be Z > A , so 2 Z = A + 1 0
The possible cases for A,Z are all excluded
Z | A | reason |
5 | 0 | number of digits would change |
6 | 2 | would be z>2a |
7 | 4 | would be z<2a |
8 | 6 | would be z<2a |
9 | 8 | would be z<2a |
So this is not possible, please note that the trivial one digit solution a = z = 0 is not admitted
Nice LaTeX
Let a n … a 0 be the starting number and assume that we can double it by reversing its digits, i.e.
+ a n … a 0 a n … a 0 a 0 … a n
It's obvious that n > 0 .
We know that 2 a n ≤ a 0 (it's not necessarily equality because there could have been carrying over). This implies that 4 a n ≤ 2 a 0 and thus 2 a 0 = a n . It follows that 2 a 0 = a n + 1 0 . Returning to 4 a n ≤ 2 a 0 gives us 4 a n ≤ a n + 1 0 , i.e. 3 a n ≤ 1 0 . Since a n must be even, it follows that a n = 2 and also a 0 = 6 . But, now it's clear that we had to carry over 2 from adding a n − 1 + a n − 1 . This is actually impossible (see below), so the answer is No .
Let c 0 be a number that we carry over when we add a 0 + a 0 and c i what we carry when we add a i + a i + c i − 1 . The claim is that c i ≤ 1 . We can prove it by induction. The base is clear since a 0 + a 0 < 2 0 . Assume that c i ≤ 1 . Then we have a i + 1 + a i + 1 + c i ≤ 1 9 . Thus, c i + 1 ≤ 1 .
It is not possible as in ABC + ABC =CBA as clearly in the first line it is shown that 2C=A,hence A>C which means that A is a greater no. hence twice of that would 2A>C hence it is not possible for the resulting no. to be twice the original no.
This is incorrect. 216+ 216 = 432. You forgot that you could carry over.
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: Cryptogram - Problem Solving
Let's approach this like a cryptogram puzzle.
ABC ABC + CBA
Since CBA has 3 digits, A must be ≤ 4.
A must also be even, because 2 × ABC is even.
Combine these two facts, and A has to be either 2 or 4.
Now look at C. The units digit of C + C must be either 2 or 4. So C has to be either 1, 2, 6, or 7.
C also has to be equal to A + A (if there's no carry over) or A + A + 1 (if there is a carry over). That means C has to be either 4, 5, 8, or 9.
Since the two lists above with the allowed values for C have no overlap, it can be concluded the answer to the question is no. □