Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|cite|improve this question

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

share|cite|improve this answer
I'm sorry, I figured out that the question in it's original form is incorrect, so I changed it. Thanks for the tip! – Hristo Hristov Feb 9 '11 at 14:19
Maybe it is Floor[Log10[N]] + 1 ? – Hristo Hristov Feb 9 '11 at 14:27
@Hristo: I agree – Ross Millikan Feb 9 '11 at 14:44
up vote 1 down vote accepted

I found out that the answer is

D = Floor[Log10[N]] + 1[Log10[2011]]+%2B+1

share|cite|improve this answer


gives the number of digits in the base 10 representation of the integer n.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.