# A magical operation

A magical operation on a particular number (not ending by 0) is the addition of this number with his symetrical number. For example the magical operation for 2018 would be 2018 + 8102 = 10120.

Let us choose a number with first digit (left one) strictly inferior to his last digit (right one). We do a magical operation on this number To get a second number and then a magical operation on this second number To get a third number and so on.

Knowing the sixth number is 17347. Can you guess the first number?

Source: tangente magazine december 2017.

TL;DR: The possible strings of magical operations are:

(first) 143 -> 484 -> 968 -> 1837 -> 9218 -> 17347 (sixth)

(first) 89 -> 187 -> 968 -> 1837 -> 9218 -> 17347 (sixth)

Rigorous proof follows...

Let's first make a few starting observations regarding the left and right numbers for a given number (result) and the number it is created from by a magical operation (operand):

1) If the left number of the result is 1 then the left and right numbers of the operand must either sum to 10 or more, or sum to 9 with a 1 carried from the addition of any middle numbers.

2) If the left number of the result is 1 more than the right number, then the left and right numbers of the operand must sum to the right number of the result, with a 1 carried from the addition of any middle numbers.

3) If the left and right numbers of the result are equal, then the left and right numbers of operand must sum to one of them, and there is no carried 1 from the addition of any middle numbers.

Any combination of left and right numbers for the result that don't meet the above criteria can't be formed by any operand.

Starting with the sixth number as 17347, then we can say that the fifth number must be...

a 4-digit number, since there is no 5-digit number that can produce the sixth number after a magical operation. The only two single-digit numbers that can produce 17 are 8 and 9, so the fifth number has to be 9ab8. The 9 has to be on the left so the numbers that sum to 8 on the right (from the prior magical operation on the fourth number) can be incremented by a carried 1. We can also determine that a and b have to sum to 3, and that the carried one that creates the 9 will also be added to a, making a one larger than b. The only solution is a=2 and b=1.

This gives us the fifth number: 9218

This then leads us to the fourth number...

which also has to be a 4-digit number abcd. We know that a and d have to add to 8, and b and c have to add to 11, and are therefore different numbers. Let's first consider the possible values for a and d. The combinations 2bc6, 3bc5, 5bc3, 6bc2, and 7bc1 are immediately out since there are no combination of numbers in a 3-digit or 4-digit third number that could make those. If it's 4bc4, then a 4-digit third number would have to be either 1gh3, 2gh2, or 3gh1, and there are no combinations of g or h that could produce two different values for b and c (since there can be no carried 1).

The only option left for the fourth number is 1bc7. This would be created by a third number xyz where x and z would have to add to create a 7 on the right and a 1 on the left, and we know from above this would mean it's 9y8. The value for b could be either 7 if y+y+1 is less than 10, or 8 if y+y+1 is greater than 10. Since b+c must be 11, the only combination that works is b=8, c=3, and y=6.

This gives us the fourth number: 1837

As well as the third number: 968

Now onto the second number(s)...

which have to be a 3-digit number a8c, where a+c equals 8 and the middle number is 8 to produce a carried 1. As above, the options 286, 385, 583, 682, and 781 are out since there are no 2-digit or 3-digit first numbers that can result in those. We're left with 484 or 187.

This gives us two possibilities for a second number: 187 and 484

And now onto the first number(s)...

For a second number 484 the first number must be a 3-digit number a4c, where a+c is 4 and a must be strictly less than (not equal to) c. Only a=1 and c=3 satisfy this.

For a second number 187, only a first number 89 works, since 98 has a left number greater than the right.

This gives us two possibilities for a first number: 89 and 143

I'd guess:

49, 58 or 67
As they all seem to work unless I'm missing something.

Going backwards from 17347:

The previous number has to be 9ab8 or 8cd9.
So two numbers before that is 9x8 or 8y9.
So number before that is 4z4. Where z causes a carry.
484 works forward to 17347 and one number backwards is 143.
49, 58 and 67 all magic to 143 obeying the first digit less than the last rule.

EDIT:

Too much magic! Thank you @Untitpoi. My not-totally-correct answer should be 143. (please see @gnovice's answer for the correct solution)

• What you age missing la that there is only 5 magical operation and you made 6 so 17347 would be the seventh number in your answer Feb 1, 2018 at 6:16

The answer is 121
121 + 121 = 242
242 + 242 = 484
484 + 484 = 968
968 + 869 = 1837
1837 + 7381 = 9218
9218 + 8129 = 17347
4 digit numbers: abcd+dbca can be abstracted to 1001x + 110y where x = a+d and y = b+c
3 digit numbers uvw+wvu can be abstracted to 101x + 20 y where x = u+w and y = v

• Welcome to Puzzling.SE! Could you hide your answer in spoiler tags to avoid spoiling your solution for others, please? Feb 1, 2018 at 11:04
• You neglected to follow one of the rules of the puzzle. "Let us choose a number with first digit (left one) strictly inferior to his last digit (right one). " Feb 1, 2018 at 14:43