Hacker News new | ask | show | jobs
by lelanthran 740 days ago
Might not work (I think Python supports bignums, not too sure).

I did this which will work with any length of number[1], and appears to work for all edge cases, including numbers that start with zero and doesn't use loops:

     (defun num-digits (n)
       (if (< n 10)
         1
         (+ 1 (num-digits (floor n 10)))))
[1] Millions of digits, if your computer has the RAM for it.