Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

9 lines
188 B

-module(collatz_conjecture).
-export([steps/1]).
steps(1) -> 0;
steps(N) when N =< 0 -> error(badarg);
steps(N) when (N rem 2 == 0) -> 1 + steps(N div 2);
steps(N) -> 1 + steps(3*N+1).