# Why do the digits of a number squared follow a similar quotient?

I realized that, any number $$k$$ with $$n$$ digits, and when $$k$$ is squared, i.e $$k^2$$ will have $$2n-1$$ or $$2n$$ digits.

Per example, let $$k = 583$$, thus $$n = 3$$ and the digits of $$583^2$$ are $$2n$$.

But I started thinking, how can I narrow the result to be more precise?

But, I asked myself. How can I determine when I will have $$2n-1$$ or $$2n$$ digits?

What I did was the following:

$$1)$$ The last number of $$1$$ digit whose square has $$2n-1$$ digits, is $$3$$ since $$3^2 = 9$$, and the next number $$4^2 = 16$$ have $$2n$$ digits. And the quotient between the max numbers of $$1$$ digit($$9$$) and the last number of $$1$$ digit to the pow of $$2$$ with $$2n-1$$ digits(3) is: $$9/3 = 3$$

$$2)$$ The last number of $$2$$ digits whose square has $$2n-1$$ digits, is $$31$$, since $$31^2 = 961$$. The quotient here is $$3.19354839$$

$$3)$$ The last number of $$3$$ digits whose square has $$2n-1$$ digits, is $$316$$ since $$316^2 = 99856$$. The quotient here is $$3.16139241$$

$$4)$$ The last number of $$8$$ digits whose square has $$2n-1$$ digits, is $$31622776$$, since $$31622776^2 = 9.9999996\cdot10^{14}$$. The quotient here is $$3.16227768871$$

The quotient is each time smaller and closer to $$3.16$$

$$i)$$ Why does the quotient between the largest number with $$n$$ digits and the last number with $$n$$ digits squared that have $$2n-1$$ follow this "pattern" closer and closer to $$3.16$$?

$$i)$$ With this I can assure for all numbers that: If i have a number, per example $$k = 7558$$ and $$k$$ have $$4$$ digits and the quotient between $$9999/7558 < 3.2$$, then $$k$$ have $$2n = 8$$ digits?

That more generally, I can assure you this?:

If i have a number $$k$$ with $$n$$ digits, this number have $$2n$$ digits if $$\frac{10^{n}-1}{k} \leq 3.2$$ otherwise it will have $$2n-1$$ digits

• $\sqrt{10}\approx3.16$ Jul 18, 2019 at 22:08
• @J.W.Tanner and what does it help me?
– ESCM
Jul 18, 2019 at 22:17
• see my answer below Jul 18, 2019 at 22:27
• EduardoS: because that's what base-10 logarithm does. floor(10^log(X)) tells you the number of (decimal) digits of X; hence floor(10 ^ 2log(X)) for X^2. As you found empirically.
– smci
Jul 19, 2019 at 19:21

If $$k^2$$ has $$2n$$ digits, then it is true that $$10^{2n-1} \leq k^2 < 10^{2n}$$, so we have $$10^{n-1}\sqrt{10} = \sqrt{10^{2n-1}} \leq k < \sqrt{10^{2n}} = 10^n$$.

If $$k^2$$ has $$2n-1$$ digits, then it is true that $$10^{2n-2} \leq k^2 < 10^{2n-1}$$, so we have $$10^{n-1} = \sqrt{10^{2n-2}} \leq k < \sqrt{10^{2n-1}} = 10^{n-1}\sqrt{10}$$.

So the cutoff you've observed is exactly at $$\sqrt{10} \approx 3.162277660168379332$$, times powers of 10.

First note this: $$k$$ has $$n$$ digits means $$10^{n-1}\le k \lt 10^{n}.$$

Now if $$10^{n-1}\le k \lt \sqrt{10} \times10^{n-1}$$,

then $$10^{2n-2}\le k^2 < 10^{2n-1}$$, so $$k^2$$ has $$2n-1$$ digits,

whereas if $$\sqrt{10} \times10^{n-1} \lt k \lt 10^n$$,

then $$10^{2n-1}\le k^2 < 10^{2n}$$, so $$k^2$$ has $$2n$$ digits.

A (natural) number $$k$$ has $$m$$ digits if an only if $$10^{m-1} \le k < 10^m$$

So $$10^{2m-2} \le k^2 < 10^{2m}$$.

If $$10^{2m-2} \le k^2 < 10^{2m-1}$$ then $$k^2$$ will have $$2m-1$$ digits.

Taking the square roots we see This happens when $$10^{m-1} \le k < \sqrt{10^{2m-1}}$$

$$\sqrt{10^{2m-1}} = \sqrt{10*10^{2m-2}} = 10^{m-1}*\sqrt {10}$$ which is never an integer.

Now... thing for a moment. If $$\sqrt{10} \approx 3.1622776601683793319988935444327....$$, then $$10^{m-1}*\sqrt{10}$$ will be $$3.1622776601683793319988935444327...$$ "shifted over $$m$$ decimal places".

So the largest possible natural number less than $$10^{m-1}*\sqrt {10}$$ will be the first $$m$$ digits of $$\sqrt{10}$$.

So a $$m$$ digit number when square will have $$2m-1$$ digits if $$k < 10^{m-1}*\sqrt 10$$ and will have $$2m$$ digits if $$k > 10^{m-1}*\sqrt 10$$. And the way can tell if $$k <$$ or $$k > 10^{m-1}*\sqrt 10$$ is by checking if the digits match the digits of $$31622776601683793319988935444327...$$ up to $$m$$ plaes.