Problem

Source: Canada RepĂȘchage 2018/6

Tags: combinatorics



Let $n \geq 2$ be a positive integer. Determine the number of $n$-tuples $(x_1, x_2, \ldots, x_n)$ such that $x_k \in \{0, 1, 2\}$ for $1 \leq k \leq n$ and $\sum_{k = 1}^n x_k - \prod_{k = 1}^n x_k$ is divisible by $3$.