r=range for i in r(2,20000): if all(i%j for j in r(2,min(i,150)))&(`i`==`i`[::-1]):print i