in reply to Re: Challenge: Nearest Palindromic Number
in thread Challenge: Nearest Palindromic Number

The odd case is not quite right, ABCDEFG can also have: ABC(D-1)CBA, or ABC(D+1)CBA
  • Comment on Re^2: Challenge: Nearest Palindromic Number

Replies are listed 'Best First'.
Re^3: Challenge: Nearest Palindromic Number
by Corion (Patriarch) on Feb 02, 2005 at 21:14 UTC

    I thought so too, but there are close palindromic numbers that do not even have any digits in common, for example 197 has 191 (6) according to my hypothesis, but 202 is closer (5). I think I'll be cutting my losses and exhaustively search the space above the number, up to the distance to the (easily found) next smaller palindromic number. Not elegant.