function IsMuenchhausen(x_::Int64) x = x_ s = 0 while x > 10 x, d = divrem(x, 10) if d > 0; s += d ^ d; end end if x > 0; s += x ^ x; end return s == x_ end function main(n::Int64 = typemax(Int64)) z = [] for x = 1:n if IsMuenchhausen(x); append!(z, x); end end return z end