Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Munchausen-numbers/Elixir/munchausen-numbers.elixir
Normal file
11
Task/Munchausen-numbers/Elixir/munchausen-numbers.elixir
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
defmodule Munchausen do
|
||||
@pow for i <- 0..9, into: %{}, do: {i, :math.pow(i,i) |> round}
|
||||
|
||||
def number?(n) do
|
||||
n == Integer.digits(n) |> Enum.reduce(0, fn d,acc -> @pow[d] + acc end)
|
||||
end
|
||||
end
|
||||
|
||||
Enum.each(1..5000, fn i ->
|
||||
if Munchausen.number?(i), do: IO.puts i
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue