Number of Digits?

Algebra Level 3

Which of these is the correct function for returning the number of digits in a positive integer, n n ?

log 10 n + 1 \lfloor \log_{10} n \rfloor +1 n 10 \left \lfloor \frac n{10} \right \rfloor log 10 n \lfloor \log_{10} n \rfloor log 10 n 1 \lceil \log_{10} n \rceil - 1 log 10 n \lceil \log_{10} n \rceil

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

You can go through then one by one and most don't work at all. ceiling(log10(n)) works for all n=/=10^m. (i.e. let n=10, log10(n)=1=ceiling(1)=/=2. )

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...