n=10 d=[0,1,0,0] while n<10000: print n d[0]+=1 if d[0]>=d[1]: d[0]=0 d[1]+=1 if d[2]<>0 and d[1]>=d[2] or d[1]>9: d[0]=0 d[1]=1 d[2]+=1 if d[2]<2:d[2]=2 if d[3]<>0 and d[2]>=d[3] or d[2]>9: d[0]=0 d[1]=1 d[2]=2 d[3]+=1 if d[3]<3:d[3]=3 n=d[3]*1000+d[2]*100+d[1]*10+d[0]