# Find the smallest $a\in\Bbb N$ if $a-\lfloor\sqrt a\rfloor^2=100$

I don't know how to solve this algebraically.

Sure, I could just brute-force this, but that wouldn't help me understand this equation. (It is not the solution that is so important, it is the way that got you there.)

How do I find the smallest $a\in\Bbb N$ for which this is true? $$a-\lfloor\sqrt a\rfloor^2=100$$ What about an arbitrary number $b\in \Bbb N$? $$a-\lfloor\sqrt a\rfloor^2=b$$

• You might start with an observation about the gaps between consecutive squares in the natural numbers. – hardmath Aug 20 '17 at 14:26
• Or you might use the fact that $\lfloor \sqrt a\rfloor\ge \sqrt a-1$. – kimchi lover Aug 20 '17 at 14:29

$f(a)=a-\lfloor\sqrt a\rfloor^2$ gives the gap between $a$ and the greatest square equal to or less than it. Suppose $\lfloor\sqrt a\rfloor=k$, then the largest value of $f(a)$ is of course obtained when $a=(k+1)^2-1$; $f(a)=2k$ in this case. The maximal values of $f(a)$ are precisely the positive even numbers.
Hence, to solve for the smallest $a$ with $f(a)=b$, find the smallest even number equal to or greater than $b$: $c=2\left\lceil\frac b2\right\rceil$. From $\left(\frac c2\right)^2$ to $\left(\frac c2+1\right)^2$ the maximum $f(a)$ will be precisely $c$, so the smallest solution for $a$ is one or two less than the latter square (depending on the parity of $b$) or simply $b$ added to the former square: $$a=\left(\frac c2\right)^2+b=\left\lceil\frac b2\right\rceil^2+b$$ For example, if $b=100$ then the smallest $a$ is $\left\lceil\frac {100}2\right\rceil^2+100=2600$.
Imagine $a$ running through the natural numbers. While $$k^2\leq a<(k+1)^2,\quad {\rm i.e.,}\quad k^2\leq a\leq k^2+2k$$ for some $k\geq0$ the difference $a-\lfloor\sqrt{a}\rfloor^2=a-k^2$ increases from $0$ to $2k$. The first time this difference reaches $100$ is when $k=50$ and $a=50^2+2\cdot 50=2600$.