For any base-$n$ number system, what is the average length of a number $\leq100$? By this I mean the amount of symbols (bits / digits / etc. ) for any number from $0$ to $100$. I don't know whether this can be answered, I'm just asking out of interest - not homework or anything.
 A: It can easily be seen that the number of digits in a the base $n$ representation of $x$ is $\lfloor\log_n x \rfloor$+1. So, the average number of digits of numbers 0-100 is
$$\frac{1}{101} + \frac{1}{101}\sum_{k=1}^{100} (\lfloor \log_{n} k\rfloor + 1)=1 + \frac{1}{101}\sum_{k=1}^{100} \lfloor \log_{n} k\rfloor .$$
A: Any integer between $n^{d-1}$ and $n^d-1$ in base-$n$ requires exactly $d$ digits. Also $0$ needs $1$ digit.
For instance, in base-$2$: 
$0 = 0_2$ through $1 = 1_2$ require $1$ digit each
$2 = 10_2$ through $3 = 11_2$ require $2$ digits each
$4 = 100_2$ through $7 = 111_2$ require $3$ digits each
$8 = 1000_2$ through $15 = 1111_2$ require $4$ digits each
$16 = 10000_2$ through $31 = 11111_2$ require $5$ digits each
$32 = 100000_2$ through $63 = 111111_2$ require $6$ digits each
$64 = 1000000_2$ through $100 = 1100100_2$ require $7$ digits each
Writing all $101$ integers between $0$ and $100$ inclusive requires $2 \cdot 1 + 2 \cdot 2 + 4 \cdot 3 + 8 \cdot 4 + 16 \cdot 5 + 32 \cdot 6 + 37 \cdot 7 = 581$ digits, so the average length of an integer between $0$ and $100$ in base-$2$ is $\frac{581}{101} \approx 5.75$ digits. 
In general, writing an integer $k$ in base $d$ requires $\lfloor \log_n k \rfloor + 1$ digits, and so, the average length of an integer between $0$ and $100$ in base-$n$ is $1 + \dfrac{1}{101}\displaystyle\sum_{k = 1}^{100}\lfloor \log_n k \rfloor$.
