TITLE: Is the number of associative $n$-ary algebraic operations on a finite set with 2 cardinality always 8?
QUESTION [8 upvotes]: We know that if $n = 2$ then the operation is called a binary operation.
$ \circ $ on set $X$ is a function $\circ : X \times X \rightarrow X$.
And the number of all associative binary operation on a finite set $X=\{1, 2\}$
 with $|X|=2$ cardinality, is 8.
 They are:       
$$1) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  1&  \\ 
      &  1&  1&
\end{array} 
2) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  1&  \\ 
      &  1&  2&
\end{array} 
3) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  1&  \\ 
      &  2&  2&
\end{array} 
4) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  2&  \\ 
      &  1&  2&
\end{array}$$ 
$$5) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  2&  1&  \\ 
      &  1&  2&
\end{array} 
6)                         
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  2&  \\ 
      &  2&  1&
\end{array} 
7) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  1&  2&  \\ 
      &  2&  2&
\end{array}
8) 
\begin{array}{c|ccccc}
\circ &  &       \\ \hline
      &  2&  2&  \\ 
      &  2&  2&
\end{array}
$$
$$1,2 \in \mathbb X$$
Also I made a program which counts associative operations when $n=3$, I mean it counts ternary associative operations based on this condition: 
$a \circ b \circ (c \circ d \circ e) = a \circ (b \circ c \circ d) \circ e = (a \circ b \circ c) \circ d \circ e$
Where $ \circ $ on set $X$ is a function $\circ : X \times X \times X \rightarrow X$.
Also $a,b,c,d,e \in \mathbb X$ and when cardinality equals $|X|=2$ .I mean when $X=\{1, 2\}$ it showed me only 8 associative operations. They are:       
$$1) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  1&   &   1& \\ 
      &  1&   &   1&     \\
      &   &  1&   &   1& \\ 
      &  1&   &   1&
\end{array} 
2) 
\begin{array}{c|ccccc}
\circ &  &  &  &          \\ \hline
      &   &  1&   &   1&  \\ 
      &  1&   &   1&      \\
      &   &  1&   &   2&  \\ 
      &  1&   &   1&
\end{array} 
3) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  2&   &   2& \\ 
      &  1&   &   1&     \\
      &   &  2&   &   2& \\ 
      &  1&   &   1&
\end{array} 
4) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  1&   &   2& \\ 
      &  1&   &   2&     \\
      &   &  1&   &   2& \\ 
      &  1&   &   2&
\end{array} $$
$$5) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  2&   &   1& \\ 
      &  1&   &   2&     \\
      &   &  1&   &   2& \\ 
      &  2&   &   1&
\end{array} 
6) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  2&   &   2& \\ 
      &  1&   &   2&     \\
      &   &  2&   &   2& \\ 
      &  2&   &   2&
\end{array} 
7) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  1&   &   2& \\ 
      &  2&   &   1&     \\
      &   &  2&   &   1& \\ 
      &  1&   &   2&
\end{array} 
8) 
\begin{array}{c|ccccc}
\circ &  &  &  &         \\ \hline
      &   &  2&   &   2& \\ 
      &  2&   &   2&     \\
      &   &  2&   &   2& \\ 
      &  2&   &   2&
\end{array} $$
So in this case I wrote result from arguments of a ternary operations in a cubic matrices as called in a tensors.
Things will get even more difficult when $n = 4$.
I wrote such a program also based on this condition:
$$a \circ b \circ c \circ (d \circ e \circ f \circ g) = a \circ b \circ (c \circ d \circ e \circ f) \circ g = a \circ (b \circ c \circ d \circ e) \circ f \circ g = (a \circ b \circ c \circ d) \circ e \circ f \circ g$$
Where $ \circ $ on set $X$ is a function $\circ : X \times X \times X \times X \rightarrow X$.
Also $a,b,c,d,e,f,g \in \mathbb X$ and when cardinality equals $|X|=2$ .I mean when $X=\{1, 2\}$ it showed me only 8 associative operations. They are: 
$$1) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                            \\ \hline
      &   &  1&   &   &   &   &   &   &   &   &   &  1& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&    \\
      &   &   &   &   &   &   1&   &   1&               \\ 
      &   &   &   &   &   1&   &   1&                   \\   
      &   &   &   &   &   &   1&   &   1&               \\ 
      &   &   &   &   &   1&   &   1&                   \\
      &   &  1&   &   &   &   &   &   &   &   &   &  1& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&    \\
\end{array} 
2) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                             \\ \hline
      &   &  1&   &   &   &   &   &   &   &   &   &  1&  \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&     \\
      &   &   &   &   &   &   1&   &   1&                \\ 
      &   &   &   &   &   1&   &   1&                    \\   
      &   &   &   &   &   &   1&   &   2&                \\ 
      &   &   &   &   &   1&   &   1&                    \\
      &   &  1&   &   &   &   &   &   &   &   &   &  1&  \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&     \\
\end{array} $$
.............................................................................................................................................................  
$$3) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                            \\ \hline
      &   &  1&   &   &   &   &   &   &   &   &   &  1& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&    \\
      &   &   &   &   &   &   2&   &   2&               \\ 
      &   &   &   &   &   2&   &   2&                   \\   
      &   &   &   &   &   &   2&   &   2&               \\ 
      &   &   &   &   &   2&   &   2&                   \\
      &   &  1&   &   &   &   &   &   &   &   &   &  1& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   1&    \\
\end{array} 
4) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                            \\ \hline
      &   &  1&   &   &   &   &   &   &   &   &   &  2& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   2&    \\
      &   &   &   &   &   &   1&   &   2&               \\ 
      &   &   &   &   &   1&   &   2&                   \\   
      &   &   &   &   &   &   1&   &   2&               \\ 
      &   &   &   &   &   1&   &   2&                   \\
      &   &  1&   &   &   &   &   &   &   &   &   &  2& \\ 
      &  1&   &   &   &   &   &   &   &   &   &   2&    \\
\end{array}$$       
.............................................................................................................................................................
$$5) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                               \\ \hline
      &   &  2&   &   &   &   &   &   &   &   &   &  1&    \\ 
      &  1&   &   &   &   &   &   &   &   &   &   2&       \\
      &   &   &   &   &   &   1&   &   2&                  \\ 
      &   &   &   &   &   2&   &   1&                      \\   
      &   &   &   &   &   &   2&   &   1&                  \\ 
      &   &   &   &   &   1&   &   2&                      \\
      &   &  1&   &   &   &   &   &   &   &   &   &  2&    \\ 
      &  2&   &   &   &   &   &   &   &   &   &   1&       \\
\end{array} 
6) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                              \\ \hline
      &   &  2&   &   &   &   &   &   &   &   &   &  2&   \\ 
      &  1&   &   &   &   &   &   &   &   &   &   2&      \\
      &   &   &   &   &   &   2&   &   2&                 \\ 
      &   &   &   &   &   2&   &   2&                     \\   
      &   &   &   &   &   &   2&   &   2&                 \\ 
      &   &   &   &   &   2&   &   2&                     \\
      &   &  2&   &   &   &   &   &   &   &   &   &  2&   \\ 
      &  2&   &   &   &   &   &   &   &   &   &   2&      \\
\end{array} $$
.............................................................................................................................................................              
$$7) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                                \\ \hline
      &   &  1&   &   &   &   &   &   &   &   &   &  2&     \\ 
      &  2&   &   &   &   &   &   &   &   &   &   1&        \\
      &   &   &   &   &   &   2&   &   1&                   \\ 
      &   &   &   &   &   1&   &   2&                       \\   
      &   &   &   &   &   &   1&   &   2&                   \\ 
      &   &   &   &   &   2&   &   1&                       \\
      &   &  2&   &   &   &   &   &   &   &   &   &  1&     \\ 
      &  1&   &   &   &   &   &   &   &   &   &   2&        \\
\end{array} 
8) 
\begin{array}{c|ccccc}
\circ &  &  &  &  &  &  &  &                              \\ \hline
      &   &  2&   &   &   &   &   &   &   &   &   &  2&   \\ 
      &  2&   &   &   &   &   &   &   &   &   &   2&      \\
      &   &   &   &   &   &   2&   &   2&                 \\ 
      &   &   &   &   &   2&   &   2&                     \\   
      &   &   &   &   &   &   2&   &   2&                 \\ 
      &   &   &   &   &   2&   &   2&                     \\
      &   &  2&   &   &   &   &   &   &   &   &   &  2&   \\ 
      &  2&   &   &   &   &   &   &   &   &   &   2&      \\
\end{array} $$
So in this case I wrote result from arguments of operations in a Hypercube as called in a "Tesseract" in order to see it more easily.        
I did not tried it when $n = 5$ because we will have $2^{(2^5)} = 4294967296 $ algebraic operations and to check it`s associative property it takes a long time!   
Will it be again 8 if $n = 5$?
So my question is: If this my program tells me true, then how to prove it using only math, I mean without programming, that the number of all associative $n$-ary algebraic operations on a finite set with 2 cardinality will be always 8?

REPLY [6 votes]: The paper "Classification of all associative mono-$n$-ary algebras with $2$ elements" by S.D.Andres (Int. J. Math. Math. Sci. (2009)) http://www.emis.de/journals/HOA/IJMMS/Volume2009/678987.pdf classifies all associative $n$-ary operations on a $2$-element set up to isomorphism, and you can easily deduce from the classification in Section 3.1 that if you count isomorphic ones separately then there are $8$ of them for any $n>1$.
The eight operations are:

 $f(x_1,\dots,x_n)=1$ for all $(x_1,\dots,x_n)$.
 $f(x_1,\dots,x_n)=2$ for all $(x_1,\dots,x_n)$.
 $f(1,\dots,1)=1$, and otherwise $f(x_1,\dots,x_n)=2$.
 $f(2,\dots,2)=2$, and otherwise $f(x_1,\dots,x_n)=1$.
 $f(x_1,\dots,x_n)=x_1$.
 $f(x_1,\dots,x_n)=x_n$.
 $f(x_1,\dots,x_n)=1$ iff an odd number of $x_i$ are equal to 1.
 $f(x_1,\dots,x_n)=1$ iff an even number of $x_i$ are equal to 1.

The first and second are isomorphic, as are the third and fourth, and the seventh and eighth are isomorphic if $n$ is even, so up to isomorphism there are five for even $n$ and six for odd $n$.