Count the number of digits in an integer using F# and log10
Your code contains a bug. What happens if number is 0? log10 0 should  return -Infinity, so we end up with the smallest int plus one. Therefore, we need to check whether input is 0 first:

let digitCount number = if number == 0 then 1 else (int) (log10 ((float)number)) + 1;


At that point we're not really succinct anymore, so there's no harm in using a recursive function instead:

let rec digitCount number = if number &lt; 10 then 1 else 1 + digitCount (number / 10)


However, that's not tail recursive, so we would want to rewrite it using a loop that's tail recursive. That's left as an exercise, though.



That being said, one can optimize counting digit a lot. 

Andrei Alexandrescu held a talk about optimizing digits_base_10 in C++ several years ago. The original talk is offline, unfortunately, but the slides are still there.