(a) Let $X$ and $Y$ be numbers that are chosen independently and uniformly at random from $\{0,1, \ldots, n\}$. Let $Z$ be their sum modulo $n+1$. Show that $X, Y$, and $Z$ are pairwise independent but not independent.
(b) Extend this example to give a collection of random variables that are $k$-wise independent but not $(k+1)$-wise independent.