From a competition we had in comp sci:
Given four integers, $a$, $b$, $c$, and $d$ take repeated absolute differences including $|a-d|$ until you reach all zeros. At each iteration,
$a' \gets |b-a|$
$b' \gets |c-a|$
$c' \gets |d-c|$
$d' \gets |a-d|$
For example, starting with $(-7,1,5,-16)$, this produces the following $6$ iterations: \begin{array}{|c|c|c|c|} \hline a & b & c & d \\ \hline -7 & 1& 5 &-16 \\ \hline 8 & 4& 21 & 9 \\ \hline 4 & 17& 12 & 1 \\ \hline 13 & 5 & 11 & 3 \\ \hline 8 & 6 & 8 & 10\\ \hline 2 & 2 & 2 & 2\\ \hline 0& 0 & 0 & 0 \\ \hline \end{array} The winner was the one to find a 4-tuple $(a,b,c,d)$ that produced the most iterations (I think the best found was around 26 iterations). The competition has been over for a while, but we all went about it the same way, by randomly generating 4-tubples and keeping track of our best.
Is there a more elegant or closed form solution to finding a 4-tuple that maximizes these iterations?
Note that because we were coding and using int datatypes, there was a minimum integer value of $-32,76$8 and maximum of $32,768$. Even with this constraint, brute-force searching would take an astronomical amount of time.