An Algebraic Approach to an Interesting Puzzle Here's the problem:

We have a hexagonal grid of side length $4$, and each grid contains a number from the set $\{1,2,3,4,5,6\}$. When we tap on any of these grids, the corresponding number on the grid and the adjacent grids would increase by $1$ and then mod 6 (so $6+1=1$). The goal is to turn all the numbers on the grids into $1$s.


My Approach
First, I named the 37 grids $1,2\cdots ,37$. Suppose the smallest sufficient number of taps on each grid are $x_1, x_2, \cdots ,x_{37}$, and the initial numbers are $a_1, a_2, \cdots , a_{37}$. Then
we want to solve a system of equations (or a $37\times 38$ matrix):
\begin{align}
\left\{
\begin{aligned}
    &x_1+x_2+x_5+x_6&=6-a_1\\
    &x_1+x_2+x_3+x_6+x_7&=6-a_2\\
    &x_2+x_3+x_4+x_7+x_8&=6-a_3\\
&\cdots\\
&x_{31}+x_{32}+x_{35}+x_{36}+x_{37}&=6-a_{36}\\
&x_{32}+x_{33}+x_{36}+x_{37}&=6-a_{37}
\end{aligned}
\right.
\end{align}
However, this is probably not the correct case. For example, if $x_1=x_2=x_5=x_6=3$, then the first equation would explode. We can infer that $x_i\in \{0,1,2,3,4,5\}$, so I might have to deal with a system of modular equations in mod 6.
\begin{align}
\left\{
\begin{aligned}
    &x_1+x_2+x_5+x_6&\equiv6-a_1\\
    &x_1+x_2+x_3+x_6+x_7&\equiv6-a_2\\
    &x_2+x_3+x_4+x_7+x_8&\equiv6-a_3\\
&\cdots\\
&x_{31}+x_{32}+x_{35}+x_{36}+x_{37}&\equiv6-a_{36}\\
&x_{32}+x_{33}+x_{36}+x_{37}&\equiv6-a_{37}
\end{aligned}
\right.
\end{align}
If I were to solve the original $37\times 38$ matrix, there would be $6^{37}$ cases (because the largest number of taps in each equation is $35$), which is too big even for computers. I hope getting some systematic advice.
Note

*

*This problem is adapted from a puzzle my friend told me.

*I hope I stated the problem and my thoughts clearly and correctly.

*I hope this is not a duplicate.


 A: Here’s a completely tractable approach.
Let $G$ be the set of cells in the grid. For each $x \in G$, let $A_x$ be the indicator function (as functions $G \rightarrow \mathbb{Z}/(6)$) of $x$ and the cell of the grid.
Our question is to find out whether any function $G \rightarrow \mathbb{Z}/6\mathbb{Z}$ (here, we want it to be one minus the initial number distribution on the grid) is in the abelian subgroup generated by the $A_x$.
Now, we can create a $37 \times 37$ matrix $A$ corresponding to the values $A_x(y)$. If its determinant is invertible mod $6$, then we’re done. But this determinant can be computed in cubic time in $\mathbb{F}_2$ and $\mathbb{F}_3$, and then we can apply the CRT (ie $A$ must be invertible mod $2$ and mod $3$).
A: There is a systematic method called row operations.  It will take thousands of calculations instead of $6^{37}$.

*

*Select one equation that contains $x_1$.  Add or subtract it from all the other equations that contain $x_1$, so that now only one equation contains $x_1$.


*Select one equation that contains $x_2$ but not $x_1$.  Once again, remove $x_2$ from all the other equations.


*Etc.  With luck, you are left with 37 equations, each contains just one $x_i$.  And that is your solution.
