To express the base $10$ number $5213$ in base $7$, all I have to do is simply divide by $7$ as follows:
$5213 \div7=744$ with remainder $5$
$744\div 7=106$ with remainder $2$
$106\div7=15$ with remainder $1$
$15 \div7=2$ with remainder $1$
Hence $5213$ in base $7$ is $21125$.
Now the formula for this operation is as follows:
$N=a_nr^n+a_{n-1}r^{n-1}+...+a_2r^2+a_1r+a_0$ where $N$ be the given number, and $r$ the radix of the proposed base.
To find the values $a_0,a_1,a_2...a_n$, divide $N$ by $r$, then the remainder is $a_0$, and the quotient is:
$a_nr^{n-1}+a_{n-1}r^{n-2}+...+a_2r+a_1$
Then continue the operation until all required digits have been acquired.
My question is if you divide $N$ by $r$, then the formula becomes thus:
$\dfrac{N}{r}=a_nr^{n-1}+a_{n-1}r^{n-2}+...+a_2r+a_1+\dfrac{a_0}{r}$ and obviously the remainder is not simply $a_0$ but rather $\dfrac{a_0}{r}$. But in the above calculation with $5213$ the remainder is $a_0$, so I'm confused about what's going on here.