Triangular numbers divided by $3$? I came across this problem.

I want to flip a triangle upside down and find the minimum number of moves to do so.
These are all triangular numbers. And I have found that dividing the total number of coins $(N)$ by $3$ will give the required result $(m)$ (ignoring the remainder).
N=3 => m=1
N=6 => m=2
N=10 => m=3 (ignoring r=1)
N=15 => m=5
N=21 => m=7
.. and so on

I have tried to do this, and all my results have been consistent with this result: $m=N/3$ so far. But I am not sure if it is true for all $N$ as I cannot prove this in a logical cohesive manner.
Is this true for all $N$, and what is the reason behind this?
 A: Let $A$ be the triangle of side length $n$, $B$ be a upside-down triangle flipped from $A$. To minimize the # of moves $m$, we only need to maximize # of coins in $A \cap B$, denoted as $S$, i.e., those coins that don't need to be moved.
Suppose the first row of $B$ is in the same level of the $i$th row of $A$. To get a maximal $S$ (may be not the maximum, it is dependent on $i$), the $i$th row of $A$ should be in the middle of the first row of $B$. Then the part $B - A \cap B$ consists of three triangles. See the figure below (those triangles with hatch lines). They are the minimal number of coins we need to move when the first row of $B$ is in the same level of the $i$th row of $A$.

There are totally $m$ coins in $B - A \cap B$, where
\begin{align}
m &= \frac{(\lceil \frac{n-i}{2} \rceil + 1)\lceil \frac{n-i}{2} \rceil}{2} +\frac{(\lfloor \frac{n-i}{2} \rfloor + 1)\lfloor\frac{n-i}{2} \rfloor}{2} + \frac{i(i-1)}{2} \\
&= \frac{\lceil \frac{n-i}{2} \rceil^2 + \lfloor \frac{n-i}{2} \rfloor^2 + i^2 + n - 2i}{2}
\end{align}
We should find the $i$ that make $m$ minimized.
I've computed the minimum $m$ for differnt $n$ (by computing the optimal $i$), summarized in the table below ($k \geq 0$).
$$
\small{
\begin{array}{c|c|c|c|c|c|c}
n & 6k & 6k + 1 & 6k + 2 & 6k + 3 & 6k + 4 & 6k + 5\\
\hline
N & 18k^2 + 3k & 18k^2 + 9k + 1 & 18k^2 + 15k + 3 & 18k^2 + 21k + 6 & 18k^2 + 27k + 10 & 18k^2 + 33k + 15\\
\hline
\text{optimal } m & 6k^2 + k & 6k^2 + 3k & 6k^2 + 5k + 1 & 6k^2 + 7k + 2 & 6k^2 + 9k + 3 & 6k^2 + 11k + 5
\end{array}
}
$$
Therefore, we have
$$
\text{optimal } m = \lfloor \frac{N}{3} \rfloor
$$
