A sequence of numbers is given as: $$1, 2, 2, 3, 3, 3, 4, 4, 4, 4, \text{and so on}$$ (Each integer $n$ is repeated $n$ times.) What will be the 50th term of that sequence?
Let's say $x=50$. Then solving $x=n(n+1)/2$ gives the value of $n$ (rounded off to nearest integer).
My question is: If I make a small change in the above pattern, can we have a direct formula to calculate $n$?
The new pattern is : $$1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, \ldots$$ i.e., $1$ and $2$ are repeated once, and $n$ is repeated $(n-1)$ times.
How can we derive a formula for this pattern?
Using JMoravitz hint above, you can replace $x$ with $x-1$ and $n$ with $n-1$ and now your formula is $x-1=(n-1)(n)/2$. Whatever you get for n should be rounded up to the nearest integer if it isn't an integer already.
For example for $x=5$, we have $4 = (n-1)(n)/2 \to 8 = (n-1)(n) \to n^2-n-8=0 \to n=3.37$ which rounds up to 4.