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.

  • $\begingroup$ Seems to me you've almost done it...letting $f(n)=1+\cdots +n$, what is $f(62)$? $f(63)$? $\endgroup$ – lulu Nov 28 '16 at 12:07

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$.


We know that $\sum_{i=1}^ni=\frac{n(n+1)}{2}$. Hence $\frac{n(n+1)}{2}+k=2013$. Moreover, $k\leq n$. Thus $2013=\frac{n(n+1)}{2}+k\leq \frac{n(n+1)}{2}+n=\frac{n(n+3)}{2}$. Thus $n^2+3n-4026\geq 0$. The roots of this equation are $-\frac{3}{2}\pm\frac{\sqrt{9+4\cdot 4026}}{2}=-\frac{3}{2}\pm\frac{\sqrt{16113}}{2}$. Now since $126^2=15876$, we get that the positive root is greater than $-\frac{3}{2}+\frac{126}{2}=61,5$. Hence $n>61$.

Now you already knew all of this. But $\frac{63\cdot 64}{2}=2016$. Hence $n<63$. Thus $n=62$. Then $k=2013-\frac{62\cdot 63}{2}=60$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.