Math question about square roots

If you have a number that is n digits in lentgh, what is the upper and lower bounds of the number of digits in the square root of n?

2n, 2n-1.

The question as worded is rather odd. I’m going to assume you meant to write: If you have a number that is n digits in lentgh, what is the upper and lower bounds of the number of digits in the square root of that number?

For n odd, it will have (n + 1) / 2 digits.
For n even, it will have n / 2 digits.

You could write this, in general, as floor((n + 1) / 2)

If the number in question is not a perfect square, then the square root will of course have an infinite number of digits after the decimal point, unless you round. My formula assumes you round down. So for instance, the square root of 99 is 9, not 10.

Arg. I completely misread the question.

The question is best answered using logarithms. The log base n of x is the number of digits required to express x in base n. Since the square root of x is x[sup]1/2[/sup], and log(x[sup]a[/sup]) = a*log(x), the square root of x requires half as many digits as x. Round like Achernar said.