Generating sequence I have these two sequences $ a,b $
$$
\begin{array}{c|lcr}
n & \text{a} & \text{b} \\
\hline
1 & 1 & 0  \\
2 & 2 & 1  \\
3 & 2 & 0   \\
4 & 3 & 2  \\
5 & 3 & 1  \\
6 & 3 & 0\\
7 & 4 & 3  \\
8 & 4 & 2  \\
9 & 4 & 1   \\
10 & 4 & 0  \\
11 & 5 & 4  \\
\vdots & \vdots & \vdots
\end{array}
$$
what should I do to write a function using $a$ and $b$ to get $n$? Can you please show me some direction? Thanks.

$$n = {a+1\choose2} - b$$
How do we get that?
Given $a$, we conclude
$$
1+2+\cdots+a \geq n > 1+2+\cdots+(a-1)
$$
where
$$
1+2+\cdots+a = {a+1\choose2}
$$
by a "well known" formula. Now, looking at $b$, we see that all we have to do is subtract $b$ from ${a+1\choose2}.$
There you are.
