function pad(num, size) {
var s = (num+1)+"";
while (s.length < size) s = "0" + s;
return s;
}
pad(004, 3);
pad(005, 3)
Code = [ 1,2,3 ].
[{A,B,C} || A <- Code, B <- Code, C <- Code ].
12> F = fun(A) -> integer_to_binary(binary_to_integer(A, 3) + 1, 3) end.
#Fun
13> F(<<"000">>).
<<"1">>
14> F(<<"001">>).
<<"2">>
15> F(<<"002">>).
<<"10">>
16> F(<<"010">>).
<<"11">>
17> F(<<"210">>).
<<"211">>