We are asked to find numbers that are integer multiples of their reversals, which I call palintiples. Of course, all the palindromic numbers are a trivial example, but if we disregard the unit multiples, the field is narrowed considerably.
Rouse Ball (Mathematical_recreations_and_essays) originated the problem, and G. H. Hardy (A_mathematician's_apology) used the result that 9801 and 8712 are the only four-digit palintiples as an example of a theorem that is not ``serious. Martin Beech (The_mathema- tical_gazette, Vol 74, #467, pp 50-51, March '90) observed that 989*01 and 879*12 are palintiples, an observation he ``confirmed on a hand calculator, and conjectured that these are all that exist.
I confirm that Beech's numbers are palintiples, I will show that they are not all of the palintiples. I will show that the palintiples do not form a regular language. And then I will prove that I have found all the palintiples, by describing the them with a generalized form of regular expression. The results become more interesting in other bases.
- numbers are palintiples
Proof: First, letting "9*" and "0*" refer an arbitrary string of nines and a string of zeroes of the same length, I note that
879*12 = 879*00 + 12 = (880*00 - 100) + 12 = 880*00 - 88 219*78 = 219*00 + 78 = (220*00 - 100) + 78 = 220*00 - 22
Now, to show that these palintiples are not all that exist, let us take the (infinite) language L[4?] = (879*12 + 0*), and let Pal(L[4?]) refer to the set of palindromes over the alphabet L[4?]. It is immediate that the numbers in Pal(L[4?]) are palintiples. For instance,
- reverse order) as the sub-palintiples on the right end of the number
is not a palintiple, because 8712 8712 87999912 is not the reverse of 2178 2178 21999978. The pumping lemma can be used to prove that Pal(L[4?])+Pal(L[9?]) is not a regular language, just as in the familiar proof that the palindromes over a non-singleton alphabet do not form a regular language.
Now to characterize all the palintiples, let N be a palintiple, N=CxR(N), where R(.) signifies reversal, and C>1 is an integer. (I use "x" for multiplication, to avoid confusion with the Kleene star "*", which signifies the concatenated closure.) If D is a digit of N, let D' refer to the corresponding digit of R(N). Since N=CxR(N), D+10T = CxD'+S, where S is the carry in to the position occupied by D' when R(N) is multiplied by C, and T is the carry out of that position. Similarly, D'+10T'=CxD+S', where S', T' are carries in and out of the position occupied by D when R(N) is multiplied by C.
Since D and D' are so closely related, I will use the symbol D:D' to refer to a digit D on the left side of a string with a corresponding digit D' on the right side of the string. More formally, an expression "x[1?]:y[1?] x[2?]:y[2?] ... x[n?]:y[n?] w" will refer to a string "x[1?] x[2?] ... x[n?] w y[n?] ... y[2?] y[1?]", where the x[i?] and y[i?] are digits and w is a string of zero or one digits. So 989901 may be written as 9:1 8:0 9:9 and 87912 may be written as 8:2 7:1 9. Thus Pal(L[4?])+Pal(L[9?]) (omitting numbers with leading zeroes) can be represented as
For each pair of digits D:D', there are a very limited--and often empty--set of quadruples S,T,S',T' of digits that satisfy the equations
yet such a quadruple must exist for "D:D'" to appear in a palintiple with multiplier C. Furthermore, the S and T' of one D:D' must be T and S', respectively, of the next pair of digits that appear. This enables us to construct a finite state machine to recognize those palintiples. The states [X#Y?] refer to a pair of carries in D and D', and we allow a transition from state [T#S'?] to state [S#T'?] on input symbol D:D' exactly when equations (2) are satisfied. Special transitions for a single-digit input symbol (the central digit of odd-length palintiples) and the criteria for the initial and the accepting states are left as exercises. The finite state machines thus formed are
for constant C=4, and
for constant C=9, and the finite state machines for other constants accept only strings of zeroes. It is not hard to verify that the proposed regular expression (1) represents the union of the languages accepted by these machines, omitting the empty string and strings beginning with zero.
I have written a computer program that constructs finite state machines for recognizing palintiples for various bases and constants. I found that base 10 is actually an unusually boring base for this problem. For instance, the machine for base 8, constant C=5 is
for which I invite masochists to write the regular expression. If anyone wants more, I should remark that the base 29 machine for constant C=18 has 71 states!
By the way, I did not find any way of predicting the size or form of the machines for the various bases, except that the machines for C=B-1 all seem to be isomorphic to each other. If anyone investigates the general behavior, I would be most happy to hear about it.