A simple challenge for the mathematically inclined.
Find a function $f\left( {{x_1},{x_2},{x_3},{x_4}} \right)$ such that $$\begin{gathered} f\left( {2,3,4,5} \right) = 1 \hfill \\ f\left( {1,3,4,5} \right) = 2 \hfill \\ f\left( {1,2,4,5} \right) = 3 \hfill \\ f\left( {1,2,3,5} \right) = 4 \hfill \\ f\left( {1,2,3,4} \right) = 5 \hfill \\ \end{gathered}$$ In constructing $f$, you may use the operations:
- addition, e.g. $x_1 + x_2$
- multiplication, e.g. $x_1x_2$
- remainder, e.g. ${x_1}\backslash {x_2}$, which is the non-negative remainder of integer $x_1$ divided by integer $x_2$; this operation has the same precedence as multiplication, hence $x_1x_2 \backslash x_3x_4$ is interpreted as $\left( {\left( {{x_1}{x_2}} \right)\backslash {x_3}} \right){x_4}$
Note that you may not use numeric constants, subtraction, or division.
The function may use as much or as little operation grouping as needed, e.g. $\left( {{x_1} + {x_2}} \right){x_1}$.
The function does not have to be valid for any inputs besides the five cases listed (you may have remainder-of-division-by-zero in extraneous cases).
Your score is the number of operations in $f$. Lower scores are better. The coveted green checkmark will go to the correct solution with the lowest score.
Can you produce a perfectly primitive parameter permuter?
1\hfill
mean? Is it just an error with the TEX? $\endgroup$