5
$\begingroup$

I want to determine the closest Triangular number a particular natural number is. For example, the first 10 triangular numbers are $1,3,6,10,15,21,28,36,45,55$ and thus, the number $57$ can be written as $$57=T_{10}+2$$ The number $54$ can be written as $$54=T_{9}+9\neq T_{10}-1$$ The second part highlights that I am looking for Triangular numbers larger than a particular positive, and not necessarily "closer" in terms of distance from Triangular numbers.

My approach would be this; given the $n$-th Triangular number has the formula $$T_n=\frac{n(n+1)}{2}=\binom{n+1}{2}$$ If I'm looking for a particular breakdown and close Triangular number, my number, say, $M$ will be of the form $$M=T_k+r$$ where $0\le r\le k$, and thus $$2(M-r)=k^2+k$$ And thus $$k=\frac{-1\pm\sqrt{1+8(M-r)}}{2}$$ I'm lost here in trying to solve, given that $r$ varies. I know that $r$ is less than or equal to $k$ but for sufficiently large $M$, how would I go about finishing solving?

$\endgroup$
9
$\begingroup$

$\binom{k}{2}\leq n$ is equivalent to $(2k-1)^2 \leq 8n+1$, hence the largest triangular number $\leq n$ is given by $\binom{k}{2}$ with: $$ k = \left\lfloor \frac{1+\sqrt{8n+1}}{2}\right\rfloor.$$

$\endgroup$
  • $\begingroup$ That was easier than I anticipated...should have known that you could floor out the $r$. Thanks! $\endgroup$ – Lalaloopsy Sep 1 '15 at 22:07
  • $\begingroup$ I think it should be $\binom{k+1}{2}\le n$ is equivalent to $(2k+1)^2\le 8n+1$... $\endgroup$ – Lalaloopsy Sep 1 '15 at 23:31
  • $\begingroup$ @Lalaloopsy: it is exactly the same, you are just replacing my $k$ with your $k+1$. $\endgroup$ – Jack D'Aurizio Sep 2 '15 at 0:05
  • $\begingroup$ But then if say, $n=4, k=3$. Since I defined $T_k=\binom{k+1}{2}$, this would mean that $T_3=6\le 4$... $\endgroup$ – Lalaloopsy Sep 2 '15 at 0:09
  • 1
    $\begingroup$ So, just a semantical argument and either way works....right? $\endgroup$ – Lalaloopsy Sep 2 '15 at 0:10

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.