6
$\begingroup$

Can someone reverse this formula? Sorry if it's too basic, I'm an old guy and my math is rusty :-D

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

If it ain't clear, by reverse I mean obtaining the value of n by providing s

Thanks

$\endgroup$

1 Answer 1

9
$\begingroup$

$$s= \frac{n^2+n}{2}$$ $$n^2+n-2s=0$$ This is a degree two polynomial equation in the variable $n$, whose positive solution is $$n= \frac{-1 + \sqrt{1+8s}}{2}$$

$\endgroup$
6
  • $\begingroup$ well, i sure as hell don't remember a polynomial equation :-(. Thanks a lot :-) $\endgroup$
    – Milad.N
    Commented May 9, 2016 at 18:48
  • 1
    $\begingroup$ The equation $ax^2+bx+c=0$ has two solutions, namely $$\frac{-b \pm \sqrt{b^2-4ac}}{2a}$$ Never seen this formula? $\endgroup$
    – Crostul
    Commented May 9, 2016 at 18:49
  • 2
    $\begingroup$ See en.wikipedia.org/wiki/Quadratic_equation $\endgroup$
    – Crostul
    Commented May 9, 2016 at 18:50
  • $\begingroup$ Of course I have :-). I've just been away from math for a very long time. I knew it had to be something like that. At first I though it was (a + b)^2, but then I remembered the sign of n is wrong. $\endgroup$
    – Milad.N
    Commented May 9, 2016 at 18:51
  • $\begingroup$ And guess what, I wanted to use it in an algorithm of some sort, but now I realised that it won't yield the result I need. Such a shame. At least I ~remembered~ re-learned some of the good stuff. $\endgroup$
    – Milad.N
    Commented May 9, 2016 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .