# Decimals of the square root of $n$.

Let $a_1, \ldots, a_k$ be any sequence of digits (i.e., each $a_i$ is between 0 and 9). Prove that there exists an integer $n$ such that $\sqrt{n}$ has its first $k$ decimals after the decimal point precisely the string $a_1\ldots a_k$. A possible solution of this problem (but by no means the only solution!) uses the fact that

$$\sqrt{n+1} - \sqrt{n} < \frac1{2\sqrt{n}}\,\,\,\text{ for all }n\geq 1$$

Can anybody please help me to approach the solution? I am not getting what the inequality has to do with decimals of root $n$.

-
Hint: consider only the case of very large integers (i.e. $n>>1$) – Yuriy S Feb 10 at 22:56
okay but then root {n+1} and root{n} will both be almost same,but whats the connection with the decimals,thats my main question. – jyoti prokash roy Feb 10 at 23:01
Do you know Taylor series? – Yuriy S Feb 10 at 23:02
yes very well.. – jyoti prokash roy Feb 10 at 23:08
@michaelchirico thanks for editing the question. – jyoti prokash roy Feb 11 at 1:10

The hint is misleading: it shouldn't use the same symbol $n$. So let's use the hint

$$\sqrt{i+1}-\sqrt i < \frac{1}{2\sqrt i} \text{ for all }i \ge 1$$

Choose $i$ large enough so that $\dfrac{1}{2\sqrt i} < 10^{-k}$. Then successive square roots $\sqrt i, \sqrt{i+1},\sqrt{i+2},\ldots$ differ by less than $10^{-k}$. Now choose $j$ large enough so that $\sqrt{i+j} > \sqrt i + 1$. Then the square roots from $\sqrt i$ to $\sqrt{i+j}$ will contain all possible sequences of $k$ digits after the decimal point. So one of them must equal $a_1\ldots a_k$.

-

Here's the idea applied to a specific case.

Let's prove that there is an integer whose square root has a fractional part that begins with a 2.

So we seek an integer $n$ such that, for some integer $m$, we have $$m+0.2 \le \sqrt{n} < m+0.3.$$ Squaring this, we have $$m^2 + 0.4m +0.04 \le n < m^2+0.6m+0.09.$$ So if an integer falls between $m^2+0.4m+0.04$ and $m^2+0.6m+0.09$, then we have our $n$. This interval has length $0.2m+0.05$ and will certainly contain an integer if $m$ is sufficiently large. Choose $m$ large enough, and we may conclude that such an $n$ exists. (For example, $n=5$ suffices, yielding the interval $[27.04,28.09]$ which contains the integer $28$ whose square root is $5.2915...$.)

The idea applies exactly the same way when you want to specify more digits in the root. You'll just need to choose larger $m$.

-

I will give you an example you do the rest.

Assume that you want to have 123.

Take $\frac{123000000}{999}$ with sufficient number of $0$'s to align the value to have $.123$ after decimal digit.

In this case you can take $3$,$6$,$9$,$12$.... zeros. In general $k$,$2k$,$3k$,$4k$,...

It is important that you can extend this as much as you like for the next step.

I will take $6$ $0$'s

$\frac{123000000}{999}=123123.123123...$

Square this number

$(\frac{123000000}{999})^2=(15159303447+\frac{65617}{110889})$

Now remove the fractional part getting $15159303447$. If you have taken a sufficiently large number of zeros, meaning sufficiently high multiple of $k$, this is your number

$$\sqrt{15159303447}=123123.12312072...$$

Except those with all $9$'s, this is the formula for all endings with sufficiently large $m$, $a=a_{1}a_{2}...a_{k}$

$$\left \lfloor (\frac{10^{mk}a}{10^k-1})^2 \right \rfloor$$

For desired number of 9's only, since the method for obvious reasons does not work for repetition of 9's, simply take $10^{2k}-1$ and you have your number.

This is working by creating a rational number with your digits as a repetition. Since you can make the initial part as large as you want, removing the fractional part in the second step will stop affecting first $k$ digits after a decimal digit at one point in time, so you can remove it as long as you have taken a sufficient number of $0$'s.

This is a proof by construction, you can do this for any $k$ and for any combination of digits with explained rule for all $9$'s.

Proof:

$$\sqrt{\left \lfloor (\frac{10^{mk}a}{10^k-1})^2 \right \rfloor}=\sqrt{ (\frac{10^{mk}a}{10^k-1})^2 k}=\frac{10^{mk}a}{10^k-1} \sqrt{k}$$

$k=\frac{\left \lfloor (\frac{10^{mk}a}{10^k-1})^2 \right \rfloor}{(\frac{10^{mk}a}{10^k-1})^2}$ which by increasing $m$ can be made to be as close as $1$ as we want, meaning we can conserve as many digits as we want from $\frac{10^{mk}a}{10^k-1}$ including the first $k$ we are interested in.

-

To use the relation you are given, $\sqrt{n+1}-\sqrt n \lt \frac 1{2\sqrt n}$, note that the positional value of $a_k$ is 10^{-k}. If $\frac 1{2\sqrt n} \lt 10^{-k}$ , which means $n \gt 10^{2k}/4$ the step between square roots will be less than $10^{-k}$ so you will hit every string of $k$ decimals. You can then take any $n\gt 10^{2k}/4$ and $m=\lfloor \sqrt{n+0.a_1a_2a_3\dots (a_k+1)}\rfloor$ is the integer you seek.

-