(Perl)
foreach $cand (0..200000){
@a=split("", $cand);
$b = join("", reverse @a);
next unless $cand==$b; # palindromes only
$len = int(@a/2.); $lenA = @a;
$len++ unless ($lenA/2 == int $lenA/2); # an even half? or include middle digit
$half = join("", @a[0..($len-1)]);
$revHalf = join("", reverse @a[0..($len-1)]);
next unless $half == $revHalf;
$str .= "$cand, ";
}
chop $str; chop $str; # remove trailing comma and space
print "$str\n"; # write to stdout
(Python)
from itertools import product
def pals(d, base=10): # returns a string
digits = "".join(str(i) for i in range(base))
for p in product(digits, repeat=d//2):
if d//2 > 0 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]:
if left + mid + right != '0': yield left + mid + right
def auptod(dd):
yield 0
for d in range(1, dd+1):
yield from (int(p+p[-1-d%2::-1]) for p in pals((d+1)//2))