Solve recurrence $a[n,k]=(2m-2k)\;a[n-1,k+1]+k\;a[n-1,k]$

57 Views Asked by At

I'm trying to count how many vectors of size $n$ there are, given that the elements of the vector are integers from the range $\{-m,m\}-\{0\}$ (zero is excluded), and there are no pair of elements whose sum is $0$.

I was able to come up with this recurrence: $$\begin{align*} a[0,k]&=1\\ a[n,k]&=(2m-2k)\;a[n-1,k+1]+k\;a[n-1,k] \end{align*}$$

The value I'm looking for is $a[n,0]$. This recurrence seems to be right, since I've wrote a brute force python script to count the vectors and the values agree.

My question is how to solve this recurrence.

EDIT: I have been able to solve it using a counting argument.

$$a[n,0]=\sum_{k=1}^m 2^k k!{m\choose k}\left\{n\atop k\right\}$$

I still don't know how to reach that using the recurrence though.

EDIT 2: Exponential generating function of the above is:

$$A(z)=(2e^z-1)^m-1$$