[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

945.0. "A palindrome algorithm" by TLE::PETERSON (Bob) Thu Oct 13 1988 16:21

This may be of interest to the regular readers here.  A coworker's daughter
came home with this 4th grade arithmetic problem.

A number is a palindrome if its (base 10) representation is the same when
reversed.  Many numbers can be turned into palindromes by this algorithm:
	add the number to its reversed representation
e.g:
	 123
	+321
	====
	 444
Thus 123 turns into a palindrome after one iteration.

Can you tell if a number will become a palindrome if the above algorithm is
applied enough times?  For example, 196 will not turn into a palindrome after
3,500 iteration.  Interestingly most numbers (under 2,000) will result in
palindromes in 25 or so iterations.  

Already this has absorbed enough developers' time, so we turn it loose on you.
A program to perform these calculations in variable-precision arithmetic is
available in TLE::FORD2$:[PETERSON.PUBLIC]PAL.FOR.  Any intensive work should
perhaps be run on a low-use machine.

(Already we've found a property of we call family trees in the numbers which do
not become palindromes, aka `magic' numbers to us.  We have not been able to
predict these arbitrarily.)
T.RTitleUserPersonal
Name
DateLines
945.1525.*LISP::DERAMODaniel V. {AITG,LISP,ZFC}:: D'EramoThu Oct 13 1988 19:423
     See note 525 and its replies.
     
     Dan
945.2CaughtTLE::PETERSONBobThu Oct 13 1988 20:413
Arg!  Well, if people used standard english I would have found that note when I
searched for DIRECTORY/TITLE=PALINDROME.  I suppose I should have anticipated
this.
945.3LISP::DERAMODaniel V. {AITG,LISP,ZFC}:: D'EramoThu Oct 13 1988 21:006
     You have to play it by ear.  Sometimes leaving off trailing
     letters (that would be chopped off by a suffix) when doing
     a search helps, but other times it results in finding
     too much.
     
     Dan