A triangular number is a number that is the sum of the natural numbers up to some $n$. The closed form is $x = \frac{n(n+1)}{2}$. How do I get $n$ on one side? I've been looking at it from every angle, and I can't find out how. Any help?
Asked
Active
Viewed 4,299 times
4
-
1Do you know the quadratic formula? – Tobias Kildetoft Mar 04 '14 at 14:44
2 Answers
9
The answer elsewhere in this thread is of course correct, but for actual calculation there is a simpler answer. We have $x = \frac12(n^2 +n)$ where $x$ is known and we want to find $n$. This is equivalent to $$2x+\frac14 = \left(n+\frac12\right)^2$$ or, neglecting the fractions, which I could justify with a more careful analysis, but won't, $$n\approx \sqrt{2x}.$$
And indeed the formula $$n = \left\lfloor\sqrt{2x}\right\rfloor$$ always gives the correct answer. ($\lfloor\ldots\rfloor$ just means to drop the fraction.)
MJD
- 67,568
- 43
- 308
- 617
-
1You might want to prove that it always gives the correct answer. Nice trick though :) – Sawarnik Mar 04 '14 at 19:42
-
-
You might want to check the answer by substituting it back in the original formula though, since this is going to give an integer always. Nice trick +1. :) – Guy Mar 05 '14 at 09:26
-
1Very nice trick. A funny way to think about it: if $x$ is the area of an equilateral triangle, $2x$ is the area of a rhombus and $\sqrt{2x}$, its side. – schneiderfelipe Jan 15 '21 at 22:33
8
$$n^2+n=2x$$
$$n^2 +n - 2x = 0$$
$$n = \frac{-1 +\sqrt{1+8x}}{2}\text{ provided $n \in \mathbb N,$ otherwise undefined}$$
For anyone unfamiliar, see proof.
Guy
- 9,055
- 1
- 30
- 58
-
Ah, how did I forget about the quadratic formula? Thanks for the help! – undo_all Mar 04 '14 at 14:47
-
-
2
-
1@Sawarnik yes, that condition is necessary and sufficient, since for all integers $x$, $1+8x$ is odd, and therefore, $\sqrt{1+8x}$ is odd and thus, $n \in \mathbb Z$ – Guy Mar 05 '14 at 09:21