Closed form of $a_i = \lvert\{\, (e_1, \dotsc, e_r) \in [0, q)^r : e_1 + \dotsb + e_r = i \,\}\rvert $

47 Views Asked by At

I encounter a curious sequence $a_i$ which is defined below. I wonder if it has a name and has some closed form.

Let $r, q$ be positive integers. (Assume further that $q$ is a prime power if necessary.) The sequence in question is defined by $$ a_i = \lvert\{\, (e_1, \dotsc, e_r) \in [0, q)^r : e_1 + \dotsb + e_r = i \,\}\rvert \quad (i \geq 0)$$ where $[0, q) = \{0, 1, \dotsc, q - 1\}$.

What I can see is the followings.

  • $a_0 = a_{r(q - 1)} = 1$
  • $a_i = \binom{r}{i}$ if $q = 2$
  • $a_i = 0$ if $i > r(q - 1)$.

(In addition, the identity $\sum_{i = 0}^{r(q - 1)} a_i = q^r$ probably holds judging from the situation I encounter.)