The first and last digits can be compared, and then the process is repeated. We require the numerical
order for the first digit. Say, 12321. The leading 1 would be obtained by multiplying this by 10,000. By
taking the mod with 10, you can get the trailing 1. Let's get this down to 232 now.
(12321 % 10000)/10 = (2321)/10 = 232
It would then be necessary to take a 100 percent reduction off of the 10,000.