Problem: Let $n$ be a positive integer.
There are $\tfrac{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.

Solution: The answer is
\[
  \max_C f(C) =
  \begin{cases}
    6k & n = 4k \\
    6k+1 & n = 4k+1 \\
    6k+2 & n = 4k+2 \\
    6k+3 & n = 4k+3.
  \end{cases}
\]
The main point of the problem is actually to determine
all linear dependencies among the $3n$ 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 \FF_2^{3n}$, with the
linear map $T \colon \FF_2^{3n} \to \FF_2^{\half n(n+1)}$
denoting the result of applying a vector $v$.
We in particular focus on the following four vectors.
\begin{itemize}
  \ii Three vectors $x$, $y$, $z$ are defined by
  choosing all $n$ lines parallel to one axis.
  Note $T(x) = T(y) = T(z) = \mathbf 1$
  (i.e.\ these vectors flip all tokens).
  \ii 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 $ABC$,
  the sum of distances from an interior point $P$
  to the three sides is equal.
\end{itemize}
The main claim is:
\begin{claim*}
  For $n \ge 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 \}$.
\end{claim*}
% (This is motivated by the validity of the claim
% when $n = 2$ and $n = 3$.)
\begin{proof}
  Suppose $T(v) = 0$.
  \begin{itemize}
    \ii 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$.
    \ii 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$.
    \ii If $v$ uses the $x$-move of length $2$, then
    \begin{itemize}
      \ii if $n$ is odd, replace $v$ with $v+\theta$;
      \ii if $n$ is even, replace $v$ with $v+(\theta+y+z)$
    \end{itemize}
    to obtain a vector in the kernel not using the $x$-move of length $2$.
  \end{itemize}
  A picture is shown below,
  with the unused rows being dotted.
  \begin{center}
  \begin{asy}
    pair A = dir(60);
    pair B = dir(0);
    real r = 0.3;
    draw( (-A)--(7*A), dashed );
    draw( (7*B-A)--(7*A-B), dashed );
    draw( (5*A-B)--(5*A+2*B), dashed );
    for (int i=0; i<=6; ++i) {
      for (int j=0; i+j<=6; ++j) {
        filldraw(CR(i*A+j*B, r), opacity(0.2)+lightcyan, black);
      }
    }
  \end{asy}
  \end{center}

  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.)
\end{proof}
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 (a_1, a_2, b_1, b_2, c_1, c_2) \]
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{align*}
  v &\longleftrightarrow (a_1, a_2, b_1, b_2, c_1, c_2) \\
  v+x+y &\longleftrightarrow \left( \left\lceil \frac n2 \right\rceil - a_1,
    \left\lfloor \frac n2 \right\rfloor - a_2,
    \left\lceil \frac n2  \right\rceil - b_1,
    \left\lfloor \frac n2 \right\rfloor - b_2, c_1, c_2 \right) \\
  v+\theta &\longleftrightarrow \left(a_1, \left\lfloor \frac n2  \right\rfloor - a_2, b_1,
    \left\lfloor \frac n2 \right\rfloor -
    b_2, c_1, \left\lfloor \frac n2 \right\rfloor - c_2\right)
  &\vdotswithin{=}
\end{align*}
and $f(T(v))$ is the smallest sum of the six numbers across all eight $6$-tuples.
So you expect to answer about $\frac32 n$
if all things are about $n/4$.
The details are too annoying to reproduce here, so they are omitted.