### Calculating the rational z whose base b digits are given

Here the *pre-period*, a_{k-1},...,a_{0} (if present) and *period* b_{r-1},...,b_{0} consist of integers in the range [0,b – 1].

Thus z = a_{k-1}/b + ··· +a_{0}/b^{k} + b_{r-1}/b^{k+1} + ··· +b_{0}/b^{k+r} + ···
If there is no pre-period, simply enter 0 0 in the pre-period box below.

If x = a_{k-1}b^{k-1} + ··· +a_{0}
and y = b_{r-1}b^{r – 1} + ··· +b_{0}, then

z={x(b^{r} – 1) + y}/{b^{k}(b^{r} – 1)}.

If there is no preperiod, then z=y/(b^{r} – 1).
Example. Take b = 10, a_{0} = 2, a_{1} = 0, b_{0} = 1, b_{1} = 3, so that z = ·023131···.

Then z = 229/9900.

*Last modified 9th February 2007*

Return to main page