Sha256: a2b9f5ab1d8f9a10423af2a11812411d64823a1b534ae81779891134e32db144

Contents?: true

Size: 324 Bytes

Versions: 80

Compression:

Stored size: 324 Bytes

Contents

-module(example).

-export([steps/1,
         test_version/0]).

steps(N) when N =< 0 -> {error, "Only strictly positive numbers are allowed"};
steps(N) ->
  steps(N, 0).

test_version() ->
  1.



steps(1, Acc) -> Acc;
steps(N, Acc) when N rem 2 =:= 0 -> steps(N div 2, Acc + 1);
steps(N, Acc) -> steps(3 * N + 1, Acc + 1).

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
trackler-2.2.1.54 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.53 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.52 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.51 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.50 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.49 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.48 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.47 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.46 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.45 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.44 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.43 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.42 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.41 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.40 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.39 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.38 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.37 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.36 tracks/erlang/exercises/collatz-conjecture/src/example.erl
trackler-2.2.1.35 tracks/erlang/exercises/collatz-conjecture/src/example.erl