# What is the least positive integer $x$ such that $x^2$ starts with 2017?

Olympiad problem that I can't find solutions except for approximations. $n$ is said to start with the $m$ digits number $k \iff n = k10^{r+m} + s$ for some integers $r,s$ such that $r \geq 0$ and $0 \leq s < 10^r$.

• I think that $m$ doesn't really matter. Shouldn't it be $n = k \cdot 10^r +s$? Apr 18, 2017 at 12:11
• @Exodd, yes. I got it wrong Apr 18, 2017 at 12:37
• The solutions here are quite reasonable, but they rely on having values of particular square roots. If one doesn't have a calculator available, then determining these values to sufficient precision is more technically demanding than the rest of the solutions as presented. Apr 18, 2017 at 12:40
• @Travis Yes. That's why I said that I couldn't solve except for the approximations - which are not possible in an Olympiad test Apr 18, 2017 at 12:45

Observe that $[\sqrt{2017}, \sqrt{2018}) = [44.911…, 44.922…)$, while $[\sqrt{20170}, \sqrt{20180}) = [142.021…, 142.05…)$. The former range tells us what kind of leading digits yield squares of the form 2017 followed by an even number of digits; the latter range tells us what kind of leading digits yield squares of the form 2017 followed by an odd number of digits. The lowest value the former range tells us to be acceptable is 4492; the lowest value the latter range tells us to be acceptable is 14203. The former is smaller, so our answer is 4492.

• I need it without approximations, as told in the post Apr 19, 2017 at 10:09
• What does without approximations mean? The problem IS essentially to give an approximation of a square root of 2017 (or any other number in its place); the answer will necessarily be a suitable number of leading digits of the square root of 2017 or 20170 (or similarly for other number chosen instead) with last excerpted digit rounded up. Apr 20, 2017 at 9:47
• (It may turn out there is some trick whereby 2017 is anomalously easy to calculate the square root of, compared to other numbers by general square root algorithms. For example, taking advantage of the closeness to 2025 = 45^2, as noted by lhf in their answer; but this then simply proceeds by one iteration of the standard Babylonian/Newton's method for iterative calculation of general square roots. Which already works well enough for our purposes! In the same way, the calculation of sqrt(20170) starting from initial guess, say, 140, quickly yields enough precision to rule it out.) Apr 20, 2017 at 9:57

$\sqrt{2017} \approx 44.91102315$ and so you need to round up this approximation times powers of $10$.

The solution is $x=4492$ because $x=45$ and $x=450$ are too big.

Indeed, $4492^2=20178064$ but $45^2$ and $450^2$ start with $2025$.

Obtaining an approximation for $\sqrt{2017}$ is easy: $$\sqrt{2017} = \sqrt{2025-8} = 45 \sqrt{1-h} \approx 45(1 - \frac{h}{2}) \approx 44.91$$ for $h=8/2025 \approx 0.004$.