long c = 0, n = 0, t, i
CFStringRef s
while ( c < 18 )
s = fn StringWithFormat(@"%ld",n)
t = 0
for i = 0 to len(s) - 1
t += intVal(mid(s,i,1))^(i+1)
next
if ( t == n )
print n
c++
end if
n++
wend
HandleEvents