Consider an $n$ by $n$ square subdivided into unit squares. What is the shortest path you can take through the square that touches every unit square? Touching the edges/vertices of the squares is sufficient, the path can be of any shape, with any start and end point.
For $n < 3$ the answer is trivially $0$.
We want to maximize the # of diagonals and minimize the # of orthogonal moves as $\frac{3}{\sqrt{2}}>\frac{2}{1}$, thanks to @Zoe Allen for pointing this out.
Here are ALL solutions for $n < 11$ brute-forced:
The rest of the current best solutions: $11-14$, $15-18$
The unions of all line segments of the current best solutions: $7-12$
OEIS sequence A383980
The website I use to draw the solutions: virtual-graph-paper.com, thanks to @Zoe Allen.
And a GitHub repository for anyone that wishes to optimize my C++ code or run it themselves.
Recursive examples $(n > 4)$ and their lengths:
# of orthogonal moves: \begin{cases} O(n)&=6+O(n-3), &n>7\\ O(6)&=10\\ O(7)&=15\\ O(5)&=9 \end{cases} $$O(n)=6k+O(n-3k)=\\ =\begin{cases} 6\left(\frac{n-6}{3}\right)+10&=2n-2, &n\equiv0\mod{3}\\ 6\left(\frac{n-7}{3}\right)+15&=2n-2+3, &n\equiv1\mod{3}\\ 6\left(\frac{n-5}{3}\right)+9&=2n-2+1, &n\equiv2\mod{3}\\ \end{cases}$$
# of diagonal moves: $$D(n)=\frac{n^2-4-2O(n)}{3}=\\ =\begin{cases} \frac{n^2-4-2\times(2n-2)}{3}&=\frac{n(n-4)}{3}, &n\equiv0\mod{3}\\ \frac{n^2-4-2\times(2n-2+3)}{3}&=\frac{n(n-4)-6}{3}, &n\equiv1\mod{3}\\ \frac{n^2-4-2\times(2n-2+1)}{3}&=\frac{n(n-4)-2}{3}, &n\equiv2\mod{3} \end{cases}$$ Path length: $$S(n)=O(n)+\sqrt{2}D(n)$$ I suspect that there aren't any solutions better than these but I don't know how to prove that the recursion is always optimal in the limit. I have since posted what I deem to be a proof for $n\equiv0\mod{3}$ as an answer, is it correct?
I also conjecture that all cases of $n\equiv2\mod{3}$ have exactly $8$ solutions for $n>10$.
The problem could be equated to a domino tiling problem, where we want to use the smallest amount of dominos possible, this is lacking rigor for now and the constraints on them may be problematic.