Commits

blooper committed 7bbd6eb

Answer for problem 3 in Erlang.

Comments (0)

Files changed (1)

Erlang/problem0003_1.erl

+-module(problem0003_1).
+-compile(export_all).
+
+ans() ->
+  N = 600851475143,
+  loop(N, 2).
+
+loop(N,D) ->
+  if
+    N == D -> N;
+    N rem D == 0 -> loop(N div D, D);
+    true -> loop(N, D+1)
+  end.