All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 2 digit Palindrome (Posted on 2004-04-05)
A palindrome is a word which reads the same backwards as it does forwards. Similarly, a number having this quality is considered 'palindromic'.

Consider the number 23. Reverse and add that number to 23 to yield the palindrome 55. This has taken one step.

Now consider the same reversal-summation process for 37. Over 2 steps it becomes the palindrome 121(37,73/110,011/121).

QUESTION: What 2 digit number requires the most stages to become a palindrome? How many stages is that, and what is the palindrome?

NOTES, THOUGHTS, CONSIDERATIONS:
1] It will become quickly evident that certain combinations will run out fast (like, why use 32 when 23 is its reverse).

2] Spreadsheet calculator - If you need one. Copy the formula ' =A1+A2 ' into cell 3 of a column. Copy it into each successively descending odd cell as may be needed. Format the column as 'Number' having no decimal places so as to override that particular time when the Exp. Not. default would normally cut in.

Enter your chosen number into A1 and continue to place the reverse total of each odd row into the cell of the next even row.

3] Obviously such sequences do occur beyond 2 digit numbers and while I have some 3 digit challenges in my personal literature, I am wondering if there is some 'easy' way of when a number becomes a palindrome - obviously I assume that it will happen with any number eventually (but should I pose that question, or even present some of the 3 digit challenges?).

 See The Solution Submitted by brianjn Rating: 2.8000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 23
`The following program 200   MaxCt=0 300   for N=10 to 99 400    N\$=mid(str(N),2,*) 500    N1\$=N\$ 600    Ct=0 700    while 1=1 800      Rev\$="" 900      for I=1 to len(N1\$)1000       Rev\$=mid(N1\$,I,1)+Rev\$1100      next1200      if val(Rev\$)=val(N1\$) then goto 17001300      N1=val(N1\$)+val(Rev\$)1400      N1\$=mid(str(N1),2,*)1500      Ct=Ct+11600    wend1700    if Ct>MaxCt then MaxCt=Ct:MaxN=N1800   next1900   print MaxN,MaxCt20002100   N=MaxN22002300   dim Hist\$(MaxCt)24002500   for N=10 to 992600    N\$=mid(str(N),2,*)2700    N1\$=N\$2800    Ct=02900    while 1=13000      Rev\$=""3100      for I=1 to len(N1\$)3200       Rev\$=mid(N1\$,I,1)+Rev\$3300      next3400      if val(Rev\$)=val(N1\$) then goto 40003500      N1=val(N1\$)+val(Rev\$)3600      N1\$=mid(str(N1),2,*)3700      Ct=Ct+13800      Hist\$(Ct)=N1\$3900    wend4000    if Ct=MaxCt then4100    :print N4200    :for I=1 to MaxCt4300    :print I,Hist\$(I)4400    :next:print4600   next`
`finds both 89 and 98 lead to the following 24 steps:1      1872      9683      18374      92185      173476      917187      1734378      9078089      171651710     887268811     1773547612     8518924713     15948740514     66427235615     131754482216     360200195317     719300401618     1329700793319     4726708716420     9344516343821     17688131787722     95559450654823     180120000210724     8813200023188`

The 3-digit equivalent gets bogged down at 196, where new numbers come up until the capacity of the programming language is exceeded.  It starts out:
1      887
2      1675
3      7436
4      13783
5      52514
6      94039
7      187088
8      1067869
9      10755470
10     18211171
11     35322452
12     60744805
13     111589511
14     227574622
15     454050344
16     897100798
17     1794102596
18     8746117567
19     16403234045
20     70446464506
21     130992928913
22     450822227944
23     900544455998
24     1800098901007
25     8801197801088
26     17602285712176
27     84724043932847
28     159547977975595
29     755127757721546
30     1400255515443103
31     4413700670963144
32     8827391431036288
33     17653692772973576
34     85191620502609247
35     159482241005228405
36     664304741147513356
37     1317620482294916822
38     3603815405135183953
39     7197630720180367016
40     13305261530450734933
41     47248966933966985264
42     93507933867933969538
43     177104867844767940077
44     947154635293536341848
45     1795298270686072793597
46     9749270977546801719568
47     18408442064004592449047

`The capacity of UBASIC is exceeded in the step (2577) after the following: 2576   880044439011753122881227195126554383818544395553644268175735928564859630922017634903288954931790771333044985874666508676306827566936271932887355354721609663611538099221683736582596296663582258972357870467881960392258314673667269768024855930759886538856785513195871004240024440339504541374445206533255322376495282571146668568158575481677993936988539115237890463050128253865814360048584457183997382559230912302662412370132045456323874299835438696407492093181627524727756948503533379814620158942724200332888136795212109955508261599529173837397484793847281825995172815549011212487740788234091537239951026408072335414750746826534627270401184814695734638003467333554540231084214157292220023065183700371864385750964407569451831049373988841412045780728399777174575960765866652065292504584223552335602544473145395042934421033500069581425587647945578958128559519768071667377412763193960179764968754269961295366691606175747277221900845116356016028452464689239073628665827713675705666478589451333068088229548883398436819130026959565720626581773446245604445808482355731491732079320357101033549978`

Edited on April 5, 2004, 9:05 am
 Posted by Charlie on 2004-04-05 09:04:20

 Search: Search body:
Forums (0)