Solve EulerProject problem #3 in Erlang