# Thread: Not the division algorithm (but fairly similar)

1. ## Not the division algorithm (but fairly similar)

Prove that for any positive integer $\displaystyle n$, there exist unique positive integers $\displaystyle k$ and $\displaystyle r$ such that $\displaystyle n = \frac{k(k-1)}{2}+r$ with $\displaystyle 1\le r\le k$.

2. Originally Posted by Sigyn3
Prove that for any positive integer $\displaystyle n$, there exist unique positive integers $\displaystyle k$ and $\displaystyle r$ such that $\displaystyle n = \frac{k(k-1)}{2}+r$ with $\displaystyle 1\le r\le k$.
Consider the set $\displaystyle \{ n - \tfrac{x(x-1)}{2}\geq 0 | x\in \mathbb{Z}^+ \}$. There exists a smallest integer $\displaystyle n - \tfrac{k(k-1)}{2} = r$. We claim that $\displaystyle r\leq k$. Assume not, then $\displaystyle r>k$ and we can write $\displaystyle r=r_0+k$ where $\displaystyle r_0<r$. Thus, we have $\displaystyle n - \tfrac{k(k-1)}{2} = r_0+k$ which gives $\displaystyle n-\tfrac{(k+1)k}{2} = r_0$. And this is a contradiction since $\displaystyle r$ was supposed to be minimal.

3. Does this also prove uniqueness?