Solution (source code)

= Solution

For the <uniform distribution> $u_r=1/n$, direct expansion gives
$$
d(p_X,u)=\sum_rp_X(r)\log_2p_X(r)+\log_2n=\log_2n-H(X).
$$
Part (a) therefore proves
$$
\boxed{H(X)\leq\log_2n,}
$$
with <equality> exactly for $p_X(r)=1/n$ for every $r$. Thus the <uniform distribution> is the unique <Shannon entropy>[entropy] maximizer.