fork(2) download
  1. exec'''from itertools import*;I,F,Q=input(),[],2
  2. while len(F)<I:F=[g for g in range(1,Q)if any(i==i[::-1]*(i[0]>'0')for i in permutations(`g`))];Q+=1
  3. print F[-1];'''*15
Success #stdin #stdout 2.9s 9136KB
stdin
1
2
3
4
5
6
7
8
9
10
42
100
128
256
270
stdout
1
2
3
4
5
6
7
8
9
11
181
404
511
994
1166