Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given two natural numbers I am supposed to reverse each of them and then sum them up and reverse the sum to get the final answer.

For example if the numbers are $4358$ and $754$ then the answer should be $1998$

I always thought that there should be a mathematical trick avoid brute force (i.e reversing each numbers and summing them up and reverse the sum to get the final answer).I heard "double reverse is no reverse" but never really get the trick myself.Could anybody help?

share|improve this question

1 Answer 1

up vote 13 down vote accepted

Line the numbers up flush left. When you carry a digit, carry to the right. Something like

4358
754  (+
------
11
 8
  9
   8
------
1998
share|improve this answer
1  
So it's boils down to the simple addition routine without reversing the strings first ... Thanks :-) –  Quixotic Mar 4 '11 at 21:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.