Sat Mar 25 08:55:47 CET 2006
I was playing with Erlang for calculation over large numbers and
discovered some issues:
1. math:log fails with "badarg" for big integers.
2. It is impossible to know how many digits in an integer _efficiently_
(i.e. with O(1) or O(log(n)), where n - number of digits).
length(number_to_list(N)) appears to have O(n).
3. Let me define the following function:
fib(0) -> 0;
fib(1) -> 1;
fib(N) -> fib(N-1) + fib(N-2).
I have failed to convert this function _without_ put/get to be able to
compute even fib(100) within reasonable period of time (I guess I did it
wrong so that tail recursion was not here). Is there a way to compute
fib(N), N>=100 without side effects?
Thank you in advance,
More information about the erlang-questions