# [Math] $(1+2+3+….+n)+k= 2013$, find $n-k$

elementary-number-theorysequences-and-series

If for some natural number '$n$' ; $(1+2+3+..+n) + k = 2013$ where $k$ is
one of the numbers $1,2,3,…..,n$, then find the value of $n-k$.

This question seems to be based on hit and trial method since we only have one equation and two variables; I got the answer using hit and trial pretty quickly, but I am sure there has to be a better approach to this question.

$$\frac{n(n+1)}{2} + k = 2013$$

is the only equation I am able to develop and also using the fact that $k$ is less than or equal to n , I got that $n> 62$. Beyond this, I have no idea how to further proceed with this question. Help me out.

You have $n(n+1) + 2k = 4026$. Using that $k \in \{1, \ldots, n\}$ we get $$n(n+1) + 2 \le 4026 \le n(n+1) + 2n = n(n+3).$$ Notice that $\sqrt{4026} \approx 63.45$ so $n$ must be close to $63$. Your $n$ should satisfy $n(n+1) \le 4024$ and $n(n+3) \geq 4026$ at the same time. Also, notice that both functions $n \mapsto n(n+1)$ and $n \mapsto n(n+3)$ are increasing on $n$. Since $$63 \cdot 64 = 4032$$ we can deduce that $n < 63$ from the first inequality. Since $$61 \cdot 64 = 3904$$ we can deduce that $n > 61$ from the second inequality. Thus, $n=62$ and $$2k = 4026 - 62\cdot 63 = 120$$ implying that $k = 60$. We conclude that $n-k = 2$.