# The Torn Number

Henry Dudeney was one of the greatest mathematical puzzlist of his time. He was the foremost champion of recreational mathematics. Here is one puzzle [Problem 113- Torn Number] from his celebrated book *Amusements in Mathematics*-

*I had the other day in my possession a label bearing the number 3025 in large figures. This got accidentally torn in half, so that 30 was on one piece and 25 on the other. On looking at these pieces, I discovered this little peculiarity. If we add the 30 and the 25 together and square the sum we get as the result the complete original number on the label! Thus, 30 added to 25 is 55, and 55 multiplied by 55 is 3025. Now, the puzzle is to find another number, composed of four figures, all different, which may be divided in the middle and produce the same result. *

Let’s try to find out how many four digit torn numbers are there. For that, I wrote a function in Wolfram language [Mathematica] on my Raspberry Pi.

tornNumberQ[n_Integer/;IntegerLength[n]==4]:= Power[Total[IntegerDigits[n, 100]], 2] == n

Now let’s use this function to find all the torn numbers composed of four digits.

Select[Range[1000, 9999], tornNumberQ] {2025, 3025, 9801}

So the other number that satisfies all the requirements of the puzzle is 9801 [98 + 01 = 99^2 = 9801]. Note that we haven't considered 2025 as an answer because the problem states that no two digits should be alike.