zlacker

[parent] [thread] 0 comments
1. lelant+(OP)[view] [source] 2024-06-06 08:15:47
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.
[go to top]