Let $n$ be a positive integer. There are $\frac{n(n+1)}{2}$ tokens, each with a black side and a white side, arranged into an equilateral triangle, with the biggest row containing $n$ tokens. Initially, each token has the white side up. An operation is to choose a line parallel to the sides of the triangle, and flip all the token on that line. A configuration is called admissible if it can be obtained from the initial configuration by performing a finite number of operations. For each admissible configuration $C$, let $f(C)$ denote the smallest number of operations required to obtain $C$ from the initial configuration. Find the maximum value of $f(C)$, where $C$ varies over all admissible configurations.
The answer is
$$
\max _{C} f(C)=\left\{\begin{array}{ll}
6 k & n=4 k \\
6 k+1 & n=4 k+1 \\
6 k+2 & n=4 k+2 \\
6 k+3 & n=4 k+3
\end{array}\right.
$$

The main point of the problem is actually to determine all linear dependencies among the $3 n$ possible moves (since the moves commute and applying a move twice is the same as doing nothing). In what follows, assume $n>1$ for convenience.

To this end, we consider sequences of operations as additive vectors in $v \in \mathbb{F}_{2}^{3 n}$, with the linear map $T: \mathbb{F}_{2}^{3 n} \rightarrow \mathbb{F}_{2}^{\frac{1}{2} n(n+1)}$ denoting the result of applying a vector $v$. We in particular focus on the following four vectors.
- Three vectors $x, y, z$ are defined by choosing all $n$ lines parallel to one axis. Note $T(x)=T(y)=T(z)=1$ (i.e. these vectors flip all tokens).
- The vector $\theta$ which toggles all lines with an even number of tokens. One can check that $T(\theta)=\mathbf{0}$. (Easiest to guess from $n=2$ and $n=3$ case.) One amusing proof that this works is to use Vivani's theorem: in an equilateral triangle $A B C$, the sum of distances from an interior point $P$ to the three sides is equal.

The main claim is:
Claim - For $n \geq 2$, the kernel of $T$ has exactly eight elements, namely $\{\mathbf{0}, x+$ $y, y+z, z+x, \theta, \theta+x+y, \theta+y+z, \theta+z+x\}$.

Proof. Suppose $T(v)=0$.
- If $v$ uses the $y$-move of length $n$, then we replace $v$ with $v+(x+y)$ to obtain a vector in the kernel not using the $y$-move of length $n$.
- If $v$ uses the $z$-move of length $n$, then we replace $v$ with $v+(x+z)$ to obtain a vector in the kernel not using the $z$-move of length $n$.
- If $v$ uses the $x$-move of length 2 , then
- if $n$ is odd, replace $v$ with $v+\theta$;
- if $n$ is even, replace $v$ with $v+(\theta+y+z)$
to obtain a vector in the kernel not using the $x$-move of length 2 .

A picture is shown below, with the unused rows being dotted.

Then, it is easy to check inductively that $v$ must now be the zero vector, after the replacements. The idea is that for each token $t$, if two of the moves involving $t$ are unused, so is the third, and in this way we can show all rows are unused. Thus the original $v$ was in the kernel we described.
(An alternative proof by induction is feasible too; as a sequence of movings which does not affect the top $n$ rows also does not affect the to $n-1$ rows.)

Then problem is a coordinate bash, since given any $v$ we now know exactly which vectors $w$ have $T(v)=T(w)$, so given any admissible configuration $C$ one can exactly compute $f(C)$ as the minimum of eight values.
To be explicit, we could represent a vector $v$ as
$$
v \longleftrightarrow\left(a_{1}, a_{2}, b_{1}, b_{2}, c_{1}, c_{2}\right)
$$
where $a_{1}$ is the number of 1 's in odd $x$-indices, $a_{2}$ number of 1 's in even $x$-indices. Then for example
$$
\begin{aligned}
v & \longleftrightarrow\left(a_{1}, a_{2}, b_{1}, b_{2}, c_{1}, c_{2}\right) \\
v+x+y & \longleftrightarrow\left(\left\lceil\frac{n}{2}\right\rceil-a_{1},\left\lfloor\frac{n}{2}\right\rfloor-a_{2},\left\lceil\frac{n}{2}\right\rceil-b_{1},\left\lfloor\frac{n}{2}\right\rfloor-b_{2}, c_{1}, c_{2}\right) \\
v+\theta & \longleftrightarrow\left(a_{1},\left\lfloor\frac{n}{2}\right\rfloor-a_{2}, b_{1},\left\lfloor\frac{n}{2}\right\rfloor-b_{2}, c_{1},\left\lfloor\frac{n}{2}\right\rfloor-c_{2}\right)
\end{aligned}
$$
and $f(T(v))$ is the smallest sum of the six numbers across all eight 6-tuples. So you expect to answer about $\frac{3}{2} n$ if all things are about $n / 4$. The details are too annoying to reproduce here, so they are omitted.