I have figured out that:
Given $N = 10^K$, $D = K + 1$.
What is the formula for a natural number $D = {???}(N)$
How to solve this in Mathematica/WolframAlpha ?
I have figured out that:
Given $N = 10^K$, $D = K + 1$.
What is the formula for a natural number $D = {???}(N)$
How to solve this in Mathematica/WolframAlpha ?
IntegerLength[n]
gives the number of digits in the base 10 representation of the integer n.
You have it (presuming that you see 000 as having 2 leading zeros and make a special case for it-the log won't work well). Just round Z up to the next $10^k-1$, or use the ceiling function: $\lceil log_{10}(N+1)\rceil$
With the change to the question, see the Hristo's comment below
I found out that the answer is
D = Floor[Log10[N]] + 1
http://www.wolframalpha.com/input/?i=Floor[Log10[2011]]+%2B+1