if this only works with 2-digit numbers beginning with 5, and the first step is to always square the first digit (which will always be 5), then you can simplify this further by saying
1) 25 + second digit
2) square second digit
2) append answer 2 to answer 1.