Five Digits Magic Prediction
A certain mathematical procedure applied to 3- and 4- digit numbers allows for an entertaining demonstration of mathematical prowess. Even more spectacular, but not more difficult is to apply the same algorithm to 5-digit numbers.
The algorithm is this:
For any integer A, let A' be obtained by writing A backwards. Compute
Before reading further you may want to investigate the possible outcomes. The applet below is a calculator designed specifically for that purpose. The blue numbers are clickable. The digits increase if clicked to the right of their vertical axis, and decrease if clicked to the left of the axis.
(Note: The difference B = |A - A'| may come out with fewer than 4 digits. When this happens B is padded with the necessary number of zeros to produce a 5-digit string which then is written backwards to give B'. For example, if
|What if applet does not run?|
For 5-digit numbers, the algorithm may lead to one of 109989, 109890, 99099, 10890.
A 5-digit decimal number A could be written as A = 104a + 103b + 102c + 10d + e, giving A' = 104e + 103d + 102c + 10b + a. In what follows I shall always assume that
B = 104(a - e) + 103(b - d) + 10(d - b) + (e - a).
Note that, since the last term is negative, this is not the decimal representation of an integer. We shall try to manipulate the terms so as to obtain a decimal representation.
The key case here is when b = d so that B = 104(a - e) + (e - a). Since
B = 10000(a - e - 1) + 9990 + (10 + e - a).
Introduce x = a - e - 1 and y = 10 + e - a. Then B = x999y and B' = y999x, with x + y = 9, making
B + B ' = 10000(x + y) + 9990 + 9990 + (x + y) = 90000 + 19980 + 9 = 109989.
Next, assume b > d. In this case,
B = 10000(a - e) + 1000(b - d - 1) + 900 + 10(9 + d - b) + (10 + e - a).
Introduce x = a - e, u = b - d - 1, v = 9 + d - b, y = 10 + e - a. All are decimal digits;
so that B + B' = 109890.
If d > b, we proceed differently:
|B||= 10000(a - e) + 1000(b - d) + 10(d - b) + (e - a)|
|= 10000(a - e - 1) + 1000(10 + b - d) + 10(d - b - 1) + (10 + e - a).|
Let x = a - e - 1, u = 10 + b - d, v = d - b - 1, y = 10 + e - a. All are decimal digits;
B + B' = 10000·9 + 1000·9 + 10·9 + 9 = 99099.
There is only one case remaining:
So, for the trick, it takes to remember only four cases - exactly as in the case of 4-digit numbers. But surely the demonstration becomes more impressive.
The derivation goes through in other bases. If V and U denote the largest and the penultimate digits in some base, then the algorithm applied to 5-digit numbers may only result in 0 (for palindromic numbers), 10VVUV
Copyright © 1996-2018 Alexander Bogomolny