Simple number theory in one unknown Given $n$ is an integer and $0 \leq n \leq 2000$, how many $n$ are there such that $\lfloor \sqrt {n} \rfloor$ divides $n$ and $\lfloor \sqrt {n+1} \rfloor$ divides $n+1$?
I'm new in number theory and I'm getting trouble assuming $\lfloor \sqrt {n} \rfloor$ as $k$ such as $k$ is also an integer. I really think this is the best method since $\lfloor \sqrt {n} \rfloor$ is the smallest integer in this problem but I still don't get the sense of my following steps. I love to see some original solutions to this so that I can choose the best method that suits to me.
I know it's so simple to you guys.I really appreciate any help and thank you in advance :)
PS. I already know how to. If $m²$ is a perfect square which has a factor of $m$ then the number before it $m² - 1$ has a factor of $m-1.$ This two consecutive numbers both have  a factor which are consecutive as well. Problem solve.
 A: For a positive integer $ n \geq 1 $, let $ d_{n} = gcd(\left \lfloor{\sqrt{n}}\right \rfloor, \left \lfloor{\sqrt{n+1}}\right \rfloor)  $. Then since from the hypothesis we know that $ \left \lfloor{\sqrt{n}}\right \rfloor \mid n $ and $ \left \lfloor{\sqrt{n+1}}\right \rfloor \mid n+1 $ we get the following:
$$ d_{n} \mid \left \lfloor{\sqrt{n}}\right \rfloor \mid n $$ $$ d_{n} \mid \left \lfloor{\sqrt{n+1}}\right \rfloor \mid n+1 $$ hence $ d_{n} \mid n $ and $ d_{n} \mid n+1 $ so $ d_{n} \mid (n+1-n) $ thus $ d_{n} \mid 1 $. Therefore either $ \left \lfloor{\sqrt{n}}\right \rfloor = \left \lfloor{\sqrt{n+1}}\right \rfloor = 1 $ or $ \left \lfloor{\sqrt{n}}\right \rfloor \geq 2 $ and $ d_{n} = 1 $.
If $ \left \lfloor{\sqrt{n}}\right \rfloor = \left \lfloor{\sqrt{n+1}}\right \rfloor = 1 $ then clearly $ n \in \{1,2\} $. Now, if $ \left \lfloor{\sqrt{n}}\right \rfloor \geq 2 $ and $ d_{n} = 1 $, what $ d_{n} = 1$ tells us is that $ \left \lfloor{\sqrt{n}}\right \rfloor $ and $ \left \lfloor{\sqrt{n+1}}\right \rfloor $ are relatively prime since by definition  $ d_{n} = gcd(\left \lfloor{\sqrt{n}}\right \rfloor, \left \lfloor{\sqrt{n+1}}\right \rfloor)  $. But clearly $$  \left \lfloor{\sqrt{n}}\right \rfloor + 1 \geq \left \lfloor{\sqrt{n+1}}\right \rfloor \geq  \left \lfloor{\sqrt{n}}\right \rfloor $$ where the RHS inequality is obvious whereas the LHS one follows from the fact that $ \sqrt{n}+1 \geq \sqrt{n+1} $(which can be easily verified by squaring). Therefore we must have that $$ \left \lfloor{\sqrt{n+1}}\right \rfloor = \left \lfloor{\sqrt{n}}\right \rfloor + 1$$.
Let $ k = \left \lfloor{\sqrt{n}}\right \rfloor $. Then $$ k \leq \sqrt{n} < k+1 $$ So $$ k^{2} \leq n < (k+1)^{2} $$ Hence $$ n+1 \leq (k+1)^{2} $$
On the other hand, we have that  $ \left \lfloor{\sqrt{n+1}}\right \rfloor = \left \lfloor{\sqrt{n}}\right \rfloor + 1$ hence $ \left \lfloor{\sqrt{n+1}}\right \rfloor = k+1$ so $ k+1 \leq \sqrt{n+1} $ which yields $ (k+1)^{2} \leq n+1 $. Therefore, from this and the above inequality, we must have that $$ n+1 = (k+1)^{2} $$ meaning that $$ n = (k+1)^{2}-1 $$ Let's verify that actually all positive integers of the form $ n=m^{2}-1 $ for $ m \geq 2 $ verify the hypothesis. So let $ n = m^{2}-1 $ for some positive integer $ m \geq 2 $. For $ m \geq 2 $ we have $$ m^{2} > n=m^{2}-1 > (m-1)^{2}$$ So $$ m > \sqrt{n} > m-1  $$ Then we must have that $\left \lfloor{\sqrt{n}}\right \rfloor = m-1 $ which clearly divides $ n = m^{2}-1=(m-1)(m+1) $. Furthermore $ n+1 = m^{2} $ hence $ \sqrt{n+1} = m $ so $  \left \lfloor{\sqrt{n+1}}\right \rfloor = m $ as well which clearly divides $ n+1 = m^{2} $.
Therefore all positive integers $ n $ of the form $ m^{2}-1$ for some positive integer $ m \geq 2 $ satisfy the hypothesis. We also saw that $ n \in \{1,2 \} $ also satisfies the hypothesis. Furthermore, $ 0 $ is also a solution as per the definition of divisibility for natural numbers i.e. we say $ k \mid n $ where $ k,n \in \mathbb{N} $ if there exists $ m \in \mathbb{N} $ such taht $ k \cdot m = n $. In the case of $ n = 0 $, all natural numbers $ k $ divide $ n $ including $ 0 $ itself since for $ n = 0 $ there exists(infinitely many, actually all natural numbers) $ m \in \mathbb{N} $ such that $ 0 = 0 \cdot m $.
To conclude, we have that $ n \in \{0,1,2\} \cup \{ m^{2}-1| m \in \mathbb{N}, m \geq 2 \} $ which answers the question of finding all natural numbers $ n $ that satisfy the hypothesis. If we are to restrict to $ n \leq 2000 $, we must find the largest positive integer $ m $ such that $ m^{2}-1 \leq 2000 $ which can be easily found to be $ 44 $. Therefore the natural numbers less than or equal to $ 2000 $ that satisfy the hypothesis are $$ n \in \{0,1,2,2^{2}-1, 3^{2}-1, 4^{2}-1, \dots , 44^{2}-1 \} = \{0,1,2,3,8,15, \dots 1935 \} $$ hence there are $ 46 $ solutions to the problem.
