Let $S$ be the set of $\{(1,1), (1,−1), (−1,1), (1,0), (0,1)\}$-lattice paths which begin at $(1,1),$ do not use the same vertex twice, and never touch either the $x$-axis or the $y$-axis. Let $S_{x,y}$ be the set of paths in $S$ which end at $(x,y).$ For how many ordered pairs $(x,y)$ subject to $1\leq x,y \leq 31$, is $|S_{x,y}|$ a multiple of $3$?
This is an old contest question from Brilliant.org.
Isn't $|S_{x,y}| = \infty$?
The set of steps allow you to go arbitrarily far and come back, without repeating vertices, or touching the axes.
Perhaps you are missing something from the problem statement?
For instance, are the paths restricted to stay within the square $1 \le x,y, \le 31$ and not just end there?