Suppose I have an arithmetic progression, e.g. 3,7,11,15,19,.... The sums of the first n elements form tuples of increasing size. E.g. the sums are:
- S(n=1)=3
- S(n=2)=10
- S(n=3)=21
- S(n=4)=36
- S(n=5)=55
So the tuples are:
- T(1)=[3;10)
- T(2)=[10;21)
- T(3)=[21;36)
- T(4)=[36;55)
Is it possible to find a formula, that would tell which tuple the integer i (which is greater than the first element=3) is falling into? E.g. for i=50 the formula should give 4.
In this case $S(n)=2n(n+1)-n=2n^2+n$.
Given $M$, you want to find a positive root of $2x^2+x-M=0$ and then take the floor.
This is $$x=\frac{-1+\sqrt{1+8M}}{4} = \frac{-1}{4} + \sqrt{\frac{1}{16}+\frac{M}{2}}$$
Not sure if there is a "clever" way to find the floor of this. You always get that the floor is "near" $\sqrt{M/2}$.
In general, given the arithmentic sequence $a,a+d,\dots,a+(n-1)d,\dots$ the sum of the first $n$ terms is:
$$S(n)=na + d\frac{n(n-1)}{2}$$
so you are seeking a positive root of:
$$dx^2+(2a-d)x -2M=0$$
So the formula is:
$$x=\frac{d-2a + \sqrt{(2a-d)^2+8Md}}{2d}=\frac{1}{2}-\frac{a}{d} + \sqrt{\left(\frac{a}{d}-\frac{1}{2}\right)^2+\frac{2M}{d}}$$
You can take the floor of that to get your $n$.
Not pretty, but it does the trick.
For $M$ somewhat large, you can start with a good upper bound of:
$$\frac{2M}{a-\frac{d}{2}+\sqrt{2Md}}$$
That estimate gives $\frac{100}{21}$ which is between $4$ and $5$, when $a=3,d=4,$ and $M=50.$