Newbie questions

Nick Linker xlcr@REDACTED
Thu Mar 30 13:30:26 CEST 2006


Joe Armstrong (AL/EAB) wrote:

>     2)  - how many (decimal) digits are there in fib(N) 
>     
>    2) is much more difficult - you could or course just compute fib(N) 
> then take the log -
> but this is cheating - so can you compute the number of decomal 
> digits  in fib(N) without
> actually going to the trouble of computing fib(N) - now this might be 
> easy but it certainly is not
> obvious...
>  
> /Joe

I'm sorry, but I meant quite different question: given a big number N, 
how to compute the number of digits?

There is obvious solution: length(integer_to_list(N)), but it is not 
very efficient. I wanted to have a bit faster solution... Ok, nevermind.

Best regards,
Linker Nick.



More information about the erlang-questions mailing list