Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an analytic form of a function that satisfies the following:

$$\begin{align*} f:\mathbb N &\to \mathbb N\\ 1&\mapsto 1\\ 2&\mapsto 2\\ 3&\mapsto 2\\ 4&\mapsto 3\\ 5&\mapsto 3\\ 6&\mapsto 3\\ 7&\mapsto 4\\ &\vdots \end{align*}$$

share|cite|improve this question
If you have the $n$th triangular number $T_n$ that is the smallest triangular number equal to or larger than $m$, note that $f(m)=n$. – Alyosha Apr 11 '13 at 16:27
up vote 2 down vote accepted

Assuming $f(n)=4$ for $7 \le n \le 10$ (so there are $4 \ \ 4$'s and so on) you are finding the minimum $m$ such that $\frac 12 m(m+1) \ge n$, which is a triangular number. To get an explicit formula, we can invert $\frac 12 m(m+1) = n$ by saying $ m^2+m-2n=0, m=\frac 12(-1+\sqrt{1+8n})$ and rounding up: $$m=\left\lceil\frac 12\bigg(-1+\sqrt{1+8n}\bigg)\right\rceil$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.