Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement