8-Bit Software Online Conversion

PALINDROMESEMORDNILAP dp-j 27Dec94 3PM This subject has created some interest in recent Issues so I would like to offer the following comment regarding the generation of such numbers. To simplify presentation I will use a', b' etc to mean a squared, b squared etc Consider the general palindrome, pal = (abcd.....dcba) Squaring this algebraically results in a central term 2(a'+b'+c'+....y'+z') if pal has an even number of terms and 2(a'+b'+c'+.....y') + z' if pal has an odd number of terms. (NB. z is taken to mean the last alphameric be it b,e,k or whatever.) All other terms of the expansion are symmetric about this central term. To take an example pal = abba pal' = abba * abba Performing the multiplication column by column as in normal arithmetic and adding the terms up in each column gives:- a', 2ab, 2ab+b', 2(a'+b'), 2ab+b', 2ab, a' which is symmetric about 2(a'+b'). In this example pal has an even no of terms. If you are feeling ambitious and try squaring abcba you find the central term is now 2(a'+b')+c'. Throwing caution to the wind if you now try squaring more and more terms you will find that a pattern emerges such that you can write the results down without bothering to do the sums at all. But in all cases the central term will be of the form quoted in the introduction above If numerical values are now substituted for a,b,c,... it is obvious that if there are no inter-column carry digits then pal' will also be palindromic. (Note that this is not to say that there will not be any palindromic squares if carry digits do occur). Further, since this central term is numerically either the largest or joint largest of all the terms then provided its magnitude is less than 10 there will be no inter-column carrys anywhere. So we can now make some observations about palindromic squares. INITIAL CONCLUSION 1) Any palindrome having an ODD no. of terms will have a palindromic square if 2(a'+b'+c'+...y')+z' is less than 10 2) Any palindrome having an EVEN no. of terms will have a palindromic square if 2(a'+b'+c'+...y'+z') is less than 10 Examining these criteria, the largest pal having a palindromic square will be infinite. Curiously an infinite pal with an odd no. of terms will be greater than one which is even ! Strange idea, a sort of alternating infinity ! So the 'biggest' pal with a palindromic square will be:- 2000.......1.......0002 with trillions of 0's in between for the 'odd' infinity and 2000..............0002 for the biggest 'even' infinity. Their squares will be 400...4...9...4...004 and 400......8......004 respectively. WHy?. Well referring to the criteria 1) above and substituting a=2 (a'=4) and z=1 (z'=1) with all other terms =0 gives 2(4+0+0+.......+0)+1 = 9 and therefore its square is also palindromic. If you additionally try putting say b=1 (b'=1) then the sum is now 2(4+1+0+0+....+0)+1 = 11 and therefore its square cannot be palindromic. Similarly using criteria 2) gives the 'even' infinity result. In either case there is no way whereby any term greater than 2 will result in a palindromic square (but see later) Of further interest, if pal is entirely composed of 1's then the above criteria indicate that pal=abcdedcba (odd) with a=b=c=d=e=1 ie pal=111111111 (nine 1's) has a palindomic square whereas pal=abcdeedcba (even) ie pal=1111111111 (ten 1's) does not. So more than nine 1's and pal' will not be palindromic. The results are not affected by interspersing 0's anywhere you wish, provided palindromic symmetry is maintained. LATER Now the Crunch. The above discourse applies to the 'no carry' condition as stated. Criteria 1) and 2) imply there will be column carry if any pal term is numerically greater than 2. Now is it possible that although any inter-column carry will upset the fundamental symmetry there may be an instance in which a carry beyond the highest place value can still, by what one might say was a sheer numerical fluke, result in a palindrome? I have, encouraged by Mr Davey's findings in Issue 39, examined this but will have to await a 'clear thinking' day. I do not have an inductive proof of non-existance of the sought for palindromes, and am not yet satisfied that my current programming attempts to eliminate some of the computer search time are foolproof. For example, if a carry into the highest place value is not equal to a' MOD 10 then pal' cannot be palindomic for starters. Testing the carrys may be quicker than squaring the palindrome and testing the result. Intuitively there must be something amiss if long computer runs are needed to solve this type of problem, but I don't deny it may give the clue to a more rational approach. My money is on looking at the pattern of the carry terms. Apart from a possible 'rogue' occurrence as yet undiscovered, all the results produced to date did not require the use of a computer at all. It's slicker in the head if criteria 1) is stored by the left ear and criteria 2) by the right, quick march! However someone must surely have already solved this one? PS. The palindromic cube. Criteria a little different but the biggest odd pal will be 1000......1......0001 and the even one 1000......0001, rogues excepted. And the 'paliquads'? The pal whether odd or even will have a maximum of two 1's and there won't be any others.