How to represent an arbitrary real number in $[0,1)$
Let $\{a_k\}_{k\geq 1}$ be a sequence of positive integers such that each $a_k > 1$. Show that every real number $x\in[0,1)$ can be represented as $$x=\sum_{k=1}^\infty\frac{x_k}{a_1a_2 \cdots a_k} ,$$ where $x_k\in\{0,1,...,a_k-1\}$.
Edit by darij grinberg: This is part of Theorem 1.6 in Ivan Niven's Irrational numbers.
When $a_k = 10$ for all $k$, this becomes the well-known fact that every number in $[0,1)$ has a base-$10$ expansion $0.x_1x_2x_3x_4\cdots$.
Choose $n_1=\lfloor a_1x\rfloor\in[0,a_1-1]$ so that $x_2=a_1x-n_1=a_1x-\lfloor a_1x\rfloor\in [0,1)$. Construct inductively $n_k$ and $x_{k+1}$ by $$ n_k=\lfloor a_k x_k\rfloor,\quad x_{k+1}=a_kx_k-n_k\in [0,1). $$ Then we can prove inductively that $$ (*)\ : \ x-\frac{n_1}{a_1}-\frac{n_2}{a_1a_2}-\cdots-\frac{n_k}{a_1a_2\cdots a_k}=\frac{x_{k+1}}{a_1a_2\cdots a_k}\in [0,\frac1{a_1\cdots a_k})\subset [0,2^{-k}). $$ That is, assuming $(*)$ is true for $k$, we have $$\begin{align*} x-\frac{n_1}{a_1}-\frac{n_2}{a_1a_2}-\cdots-\frac{n_k}{a_1a_2\cdots a_k}-\frac{n_{k+1}}{a_1a_2\cdots a_{k+1}}&=\frac{x_{k+1}}{a_1a_2\cdots a_k}-\frac{n_{k+1}}{a_1a_2\cdots a_{k+1}}\\&=\frac{a_{k+1}x_{k+1}-n_{k+1}}{a_1a_2\cdots a_{k+1}}\\&=\frac{x_{k+2}}{a_1a_2\cdots a_{k+1}} \end{align*}$$ holds for $k+1$. It follows $$ x-\sum_{k=1}^N\frac{n_k}{a_1a_2\cdots a_{k-1}a_k}\xrightarrow{N\to\infty} 0. $$