Let $a$ be an odd positive integer. Let $n$ be a positive nonzero integer. Let $D_a$ be the sequence whose terms are the arithmetic progression $an+2$. Now arrange the terms of $D_a$ into a triangle. For examples
$$D_3 = \begin{matrix} &&&&&65&\ldots \\ &&&&47&62&\ldots \\ &&&32&44&59&\ldots \\ &&20&29&41&56&\ldots \\ &11&17&26&38&53&\ldots \\ 5&8&14&23&35&50&\ldots \end{matrix}$$ and $$D_5 = \begin{matrix} &&&&&107&\ldots \\ &&&&77&102&\ldots \\ &&&52&72&97&\ldots \\ &&32&47&67&92&\ldots \\ &17&27&42&62&87&\ldots \\ 7&12&22&37&57&82&\ldots \end{matrix}$$
Let $f_a$ be the uppermost slope in $D_a$. So for example $f_3=5,11,20,\ldots$ and $f_5$ would be the sequence $7,17,32,\ldots$ For each $a$ arrange each slope $f_a$ column wise in ascending order to form a matrix
$$M = \text{ }\begin{matrix} 5&7&9&11&13&\ldots \\ 11&17&23&29&35&\ldots \\ 20&32&44&56&92&\ldots \\ 32&52&72&92&112&\ldots \\ 47&77&107&137&167&\ldots \\ 65&107&149&191&233&\ldots \\ 86&142&198&254&310&\ldots \\ 110&182&254&326&398&\ldots \\ \vdots&\vdots&\vdots&\vdots&\vdots&\ddots \end{matrix}$$
Let $i$ and $j$ be the $i$-th and $j$-th row and column of $M$ respectively. Denote the $ij$-th entry of $M$ by $m_{ij}$ and let $R_{ij}=\{m_{ab} \mid m_{ab} \leq m_{ij}\text{ and } b\leq j \}$.
Is there a closed formula to compute the size of $R_{ij}$ ?
By the size I mean the order of the set $R_{ij}$. So for example $|R_{53}|=17$. I can show by inspection the $m_{ij}$ entry of $M$ can be computed by the formula $$i(i+1)j+{i+1 \choose 2}+2$$ For example the entry $m_{54}$ can be shown to be $5(5+1)4+{5+1 \choose 2} +2=120+15+2=137$. I can show that $R_{ij}\geq ij-1$ with equality only holding for $i$ and $j$ both equal to $2$.