Let the sequence be $1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...,n, n, n, n, ..., n...$. The function $f(k)$ will return the $k$th term of this sequence. Using properties of this sequence, it is not too hard to see that if $f(r)=n$, then $r\in\{\frac{n(n-1)}{2}+1+k | k\in\mathbb{W}\}$.
The following questions arise out of just curiosity. On a graph, this function looks like many things. My first guess was that it was some sort of logarithm (idea later revised), but my immediate question was: for domain $[1, p]$, what logarithm base, denoted $b$, would provide the best approximation? Around $2$? My second question is: would a better approximation be a parabola/hyperbola. The sequence slows down very quickly, so instead of a parabola, could it be some sort of flipped $x^6$ or higher even power?
