dim a(4e3) for i=1to 3e3n=i r=i while(n)r=r+mod(n,10) n=int(n/10)wend if!a(i)?i a(r)=1next