What is an example of a binary operation on the set $\{1, \dots, n\}$ so that each element $k \in \{1, \dots, n\}$ has respectively $k-1$ left inverses?
I have been trying various combinations with $\bmod$, $\gcd$, and $\text{lcm}$, among others.
I thought that $\gcd(\bmod(k,n), \bmod(n,k))$ for every $k$ would do it, but the neutral element of $\gcd$ is $0 $and this equals to $1$ for all $k < n$ and $0$ for $k = n$. And it really should be the other way around.
Any ideas?
By definition, a (two-sided) identity $e$ of an operator $\ast$ has precisely one left inverse, and so the identity must be $e = 2$. (In particular, this means the condition cannot be satisfied when $n = 1$, and so we henceforth assume $n > 1$.)
This determines $2 n - 1$ entries of the Cayley table for $\ast$: $$\begin{array}{c|ccccc} \ast & 1 & 2 & 3 & \cdots & n \\ \hline 1 & \cdot & 1 & \cdot & \cdots & \cdot \\ 2 & 1 & 2 & 3 & \cdots & n \\ 3 & \cdot & 3 & \cdot & \cdots & \cdot \\ \vdots & \vdots & \vdots & \vdots & & \vdots \\ n & \cdot & n & \cdot & \cdots & \cdot \\ \end{array}$$ In order to satisfy the condition, the $k$th column of the table must contain exactly $k - 1$ $2$'s, but each column (other than the second) in the above partially completed table has $n - 1 \geq k - 1$ unfilled slots, so we can complete the Cayley table in a way that satisfies that condition for arbitrary $n$.
Imposing this condition shows that only one operation satisfies this condition for $n = 2$, namely the one with Cayley table $$\begin{array}{c|cc} \ast & 1 & 2 \\ \hline 1 & 1 & 1 \\ 2 & 1 & 2 \\ \end{array},$$ and that there are four operations that do for $n = 3$: The column condition imposes $1 \ast 3 = 3 \ast 3 = 2$, and we can freely assign each of $1 \ast 1$ and $3 \ast 1$ to be either $1$ or $3$. I do not, however, immediately see a more compact description of any of these four operations.
Making some simple choices for the remainder of the table yields the following operation $\ast$ that satisfies the given conditions for any $n$: $$ i \ast j := \left\{ \begin{array}{rl} i, & j = 2 \\ j, & i = 2 \\ 1, & i = j = 1 \\ 1, & i > j \text{ and } i, j \neq 2, \\ 2, & i \leq j \text{ and } i, j \neq 2 \text { and } (i, j) \neq (1, 1) \end{array} \right. . $$