Euler solution in Erlang