by ConMan » Thu May 31, 2012 4:56 am UTC
Well, the sum of natural numbers from 1 to n is the nth triangular number, given by T(n) = n(n+1)/2, so you're basically trying to find the inverse function T^-1(x), then taking the floor of this value. A quick bit of algebra gives:
x = T(y) = y(y+1)/2
y² + y - 2x = 0
y = (-1 + sqrt(1 + 8x))/2 <- taking the positive solution only since you want a natural number
n = floor(y) = floor((sqrt(8x + 1) - 1)/2)
pollywog wrote:Wikihow wrote:* Smile a lot! Give a gay girl a knowing "Hey, I'm a lesbian too!" smile.
I want to learn this smile, perfect it, and then go around smiling at lesbians and freaking them out.