# Does this deceptively simple nonlinear recurrence relation have a closed form solution?

Given the base case $$a_0 = 1$$, does $$a_n = a_{n-1} + \frac{1}{\left\lfloor{a_{n-1}}\right \rfloor}$$ have a closed form solution? The sequence itself is divergent and simply goes {$$1, 2, 2+\frac{1}{2}, 3, 3+\frac{1}{3}, 3+\frac{2}{3}, 4, 4+\frac{1}{4}, 4+\frac{2}{4}, 4+\frac{3}{4}, . . .$$} and so forth. It seems like it should be easy but I can't seem to find a solution. Any suggestions?

• I will point out that the tag (discrete-mathematics) is deprecated on MathOverflow, see the tag-info. Moreover, the question is also missing top-level tag. Since I am not really sure about a suitable choice of tags for this question, I'll leave retagging to more experienced users. Feb 22 '19 at 18:23

The sequence $$a_n$$ for $$n\geq 1$$ has the following formula: $$a_n=\left\lfloor \sqrt{2n}+\tfrac{1}{2}\right\rfloor +\frac{\left\lfloor \frac{1}{2} \left(\sqrt{8 n-7}+1\right)\right\rfloor-\left\lfloor \frac{1}{2} \left(\sqrt{8 n-7}+1\right)\right\rfloor ^2 +2 n}{2 \left\lfloor \sqrt{2n}+\frac{1}{2}\right\rfloor }.$$ Here is the Wolfram Alpha link to check it.

It is related to OEIS A002024 and OEIS A002262.

• Great! Thanks, Carlo. Looking at that, I would have never have found that on my own. :-) Feb 20 '19 at 20:14

A similar, possibly simpler closed form is the following: set $$b_n=\left\lfloor\frac{1+\sqrt{8n-7}}{2}\right\rfloor,$$ then $$a_n=\frac{b_n+1}{2}+\frac{n-1}{b_n}.$$ It is not hard to derive this from the observation that whenever $$n-1$$ is a triangular number $$k(k-1)/2$$, one has $$a_n=k$$.

• it does not quite seem to work: I find from your formula $1,2,2,\frac{5}{2},3,3,\frac{10}{3},\frac{11}{3},4,4,\frac{17}{4},\frac{9}{2},\frac{19}{4},5,5,...$, so there is this repetition of the integers which should not be there... --- here is the Wolfram Alpha link --- did I make a mistake? Feb 22 '19 at 20:34
• No, I did... Thanks! I had done everything in my mind and forgot to check Feb 23 '19 at 9:00
• yes, the corrected formula now works as intended: Wolfram alpha Feb 23 '19 at 14:11
• Actually the other night, I found Ale's simpler form as well only with $b_n = \left \lfloor{\sqrt{2n}+\frac{1}{2}}\right \rfloor$ instead. Apparently $\left \lfloor{\frac{1+\sqrt{8n-7}}{2}}\right \rfloor = \left \lfloor{\sqrt{2n}+\frac{1}{2}}\right \rfloor$. Feb 23 '19 at 17:20

I have decided to call this sequence $$\Theta_n$$ for the triangular-harmonic number sequence because it clearly has properties related to both triangular and harmonic numbers.

I had been studying it by using the recursive definition $$\Theta_0 = 1\mid\Theta_n = \Theta_{n-1} + \frac{1}{\lfloor\Theta_{n-1}\rfloor}$$ The simplest closed form of the sequence is
$$\Theta_n = \frac{T_n^{-1}}{2} + \frac{n}{T_n^{-1}} + \frac{1}{2} \mid n\geq1$$ with $$T_n^{-1}=\lfloor\sqrt{2n}+\frac{1}{2}\rfloor$$ being the inverse triangular number function. I have been researching its many fascinating properties.