0

We have a regular polygon with $n$ vertices. We start at one vertex and want to get to another. The least number of hops we need to get from the starting to target vertex is $s$. How many ways are there to go from the starting to the target vertex in exactly $h$ hops. This becomes a function $f(n,s,h)$ ($s \in [0,\left[\frac{n}{2}\right]]$). Is there a closed-form or recurrence for this function?


Example: Let $n=3$ (triangle), $s=1$. We get:

$$f(3,1,h)=f(3,0,h-1)+f(3,1,h-1)$$

$$=f(3,1,h-1)+2 f(3,1,h-2)$$.

This recurrence yields the Jacobsthal numbers.

Rohit Pandey
  • 6,803

1 Answers1

1

Let us define $f(s, h)$ as the number of walks to get to the target vertex in $h$ hops, provided we're currently $s$ hops away (oriented, so $s$ can be negative), but instead of a polygon we have a line (this is analogous to $n = \infty$). Then, it is not hard to see that $$ f(n, s, h) = \sum_{k=-\infty}^{\infty} f(s + kn, h). $$ (Only finitely many of the summands will be nonzero, assuming $n > 0$.) This is just accounting for walks which go around the polygon a certain number of times. Now we will focus our attention towards finding an explicit formula for $f(s, h)$. We have the recurrence $$ f(s, h) = \begin{cases} 1 & h = 0, s = 0 \\ 0 & h = 0, s \neq 0 \\ f(s+1, h-1) + f(s-1, h-1) & h > 0. \end{cases} $$ This recurrence has solution $$ f(s, h) = \begin{cases} \binom{h}{(h+s)/2} & h = s \bmod{2} \\ 0 & h \neq s \bmod{2}, \end{cases} $$ where $\binom{n}{r}$ is defined to be $0$ for $r < 0$ or $r > n$.

Combining this with the summation from before, we have a couple cases for $n$ even or odd and $h - s$ even or odd. In all of these cases, we want to compute a summation of the form $$ \sum_{k=-\infty}^{\infty} \binom{h}{x+ky}, $$ where $x$ is either $\frac{h+s}{2}$ or $\frac{h+s+n}{2}$ and $y$ is either $\frac{n}{2}$ or $n$ depending on the parities mentioned above. We can compute this summation using any of a number of strategies, such as a root of unity filter; in particular, if we let $\omega$ be a primitive $y$-th root of unity, then the solution can be expressed in the form $$ \sum_{j=0}^{y-1} \omega^{-jx} (1 + \omega^j)^h. $$ This can't be reduced further easily, but it's closer to a closed form than nothing.

hdighfan
  • 4,067