in reply to Challenge: Nearest Palindromic Number
While not the whole answer, solutions (such as the quick Roy Johnson's) would use code similar to this:
sub palindrate { my $number = shift . ''; my $front = substr($number, 0, (length($number)+1)/2); my $back = reverse($front); chop($front) if not (length($front) % 2); return $front . $back; }
Edge cases I can think of:
--
[ e d @ h a l l e y . c c ]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Challenge: Nearest Palindromic Number
by Limbic~Region (Chancellor) on Feb 02, 2005 at 19:23 UTC | |
by halley (Prior) on Feb 02, 2005 at 19:27 UTC | |
by herveus (Prior) on Feb 02, 2005 at 19:51 UTC | |
by tilly (Archbishop) on Feb 03, 2005 at 06:55 UTC | |
by Limbic~Region (Chancellor) on Feb 02, 2005 at 19:34 UTC | |
by halley (Prior) on Feb 02, 2005 at 19:45 UTC | |
by herveus (Prior) on Feb 02, 2005 at 19:25 UTC | |
by Limbic~Region (Chancellor) on Feb 02, 2005 at 19:27 UTC |