good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Challenge: Nearest Palindromic Numberby herveus (Prior) |
on Feb 02, 2005 at 20:08 UTC ( [id://427409]=note: print w/replies, xml ) | Need Help?? |
Howdy!
The problem is to find which of the two nearest palindromic numbers is closest. If missing one of the pair when both are equally distant is acceptable (as in the problem as laid out here), then slinging strings is both fast and elegant, given that palindromicity is a string property, not a numeric property. The solution Roy_Johnson got into print before I could (and which is a refinement of halley's, attacks the given problem about as elegantly as you can.
yours, Michael
In Section
Seekers of Perl Wisdom
|
|