Formula for the simple sequence 1, 2, 2, 3, 3, 4, 4, 5, 5, ...

How about: $$ \frac{3+2n+(-1)^n}{4} $$ or (continuous function of $n \in \mathbb R$ or even $\mathbb C$): $$ \frac{3+2n+\cos(\pi n)}{4} $$


The formula is $$n\to \left\lfloor \frac{n}{2} \right\rfloor +1$$ where the notation $\lfloor x \rfloor$ means the greatest integer not exceeding $x$.


The formula below uses the floor function. $\lfloor x\rfloor$ denotes the floor function of x. For example, $\lfloor2\rfloor=2$ while $\lfloor2.5\rfloor=2$. For more on the floor and ceiling functions, go checkout Wikipedia's page on them.

$\frac{2i}{2}=i$, so $\lfloor\frac{2i}{2}\rfloor=i$. Meanwhile, $\frac{2i+1}{2}=i+\frac 1 2$, so $\lfloor\frac{2i+1}{2}\rfloor=i$. Therefore, for any $x$ that is either $2i$ or $2i+1$, $\lfloor\frac x 2\rfloor+1=i+1$. Thus, the function you are looking for is $f(x)=\lfloor\frac x 2\rfloor+1$.