Let $S$ be a finite set of $n$ elements. For which $n$ can the Cartesian Product $S\times S$ be partitioned in such a way that elements of the partition are of one of the following forms:
$\{(a,b), (b,c), (c,a)\}$, $\{(a,a), (a,b), (b,a)\}$, or $\{(a,a)\}$
I abbreviate these as the triples $abc, aab, aaa$ respectively, where it is understood that an ordered pair is a member of the triple $x_1x_2x_3$ if the pair is either $(x_1, x_2)$, $(x_2, x_3)$, or $(x_3, x_1)$. Furthermore, I deal with sets of the form $\{0,1,2,...,n-1\}$, to allow ease of computation.
It can be shown that this is equivalent to asking if there is a binary operation $*$ on $S$ for which $(a*b)*a=b$ for all $a,b \in S$, where the partitions are given by $(a,b) \in \{(a,b), (b,a*b), (a*b, a)\}$.
Since $+$ is such an operation on the group $\mathbb{Z}_2 \times \mathbb{Z}_2 \times ... \times \mathbb{Z}_2$ (where $\times$ is the direct product), this shows that $n=2^k$ always has such a partition.
However, I have also such partitions for n = 3, 5, and 6, found via brute force computation, given below.
1: 000
2: 000 011
3: 000 012 021 111 222
4: 000 011 022 033 123 132
5: 000 011 022 033 044 123 134 142 243
6: 000 011 022 033 045 054 124 135 143 152 234 253 444 555
I haven't found such partitions for 7 or 9, which leads me to believe that for those n, no such partition exists, however, I don't have any proof. I don't see any obvious pattern, nor can I find a way to generate a larger such partition from a smaller one in some sort of inductive fashion, nor can I find any "classes" of solutions other than $n=2^k$. I started casually working on this problem after working through problem A-1 of the 2001 Putnam Mathematical Competition. I am curious to know if any of you can solve the problem, or failing that, grant any insight into it.
Such partitions always exist.
In the equivalent question about the existence of a semisymmetric quasigroup on $\{0,1,\dots,n-1\}$, you can use the operation defined by $$ a*b=(-a-b) \bmod n.$$
I found this as answer to question 26(c) in Donald E. Knuth's two days old The Art of Computer Programming, Volume 4, Pre-Fascicle 5C on Dancing links, which I happened to find by once more googling for "semisymmetric quasigroups". It also gives other ways of getting these structures, that the author calls gropes, from groups. Question 26(d) is about the equivalence of these structures and partitions by triples.
Dancing links, by the way, is also the method I used to obtain the results given in my comments to the question.