with(numtheory): P:=proc(q) local a, b, i, j, k, n;
for n from 1 to q do a:=convert(10^(ilog10(n)+1)-n, base, 10);
b:=convert(a, `*`); j:=1; i:=0; while n>b do
if i=b then break; else i:=b; j:=j+1; b:=add(a[k]^j, k=1..nops(a)); fi; od;
if n=b then print(n); fi; od; end: P(10^9);
|