Let $X$ be a finite set of $n$ elements, and consider a binary operation $\odot: X \times X \rightarrow X$. There are $n^{n^2}$ such binary operations, as the $n \times n$ table entries can each
be filled with one of $n$ elements of $X$. My question is:



> 
> How many of the $n^{n^2}$ binary operations are associative, i.e., $(x \odot y) \odot z = x \odot (y \odot z)$?
> 
> 
> 


Unless I miscomputed this, for $n=2$, exactly half of the $2^4=16$ binary operations are associative.
But for $n=3$, only $113$ of the $3^9=19,683$ binary operations are associative, a count
I do not trust, because it seems so much smaller than I anticipated.
(It is difficult to count among the four billion ($4,294,967,296$) binary operations for $n=4$.)


I would be interested in the asymptotic growth rate.
Surely this is all well known...? Thanks for pointers!


**Update**. Following MSE link provided by Darij, I reached (via Gerry Myerson's pointer) the [OEIS sequence A023814](http://oeis.org/A023814). The $n=4$ number I couldn't easily compute is $3492$.



How many binary operations are associative?
Here is a guide to the intuition. I will not swear that the numerics are exact, but I will bet 
that the numerical truth is not far off.


Look at the diagonal for the multiplication table of a (labeled) groupoid on $n>3$ elements.
Of the n^n possibilities, only one of them is idempotent, so with one exception aa=b will happen for some a and some b different from a. Now all we need for associativity to fail in this case is that ab and ba are different, which will happen for all but n of the n^2 possibilities. So we are already looking at associativity happening 
only on a small fraction of all (non-idempotent) tables, especially as there are often several candidates for a, and only one is needed.


Even for idempotent groupoids, one finds a,b,c distinct and needs to consider only d=ab, g=bc, and the ways in which dc and ag can fail to be equal. Again in rough terms we are talking about n^(-2), and this is just by fixing a,b, and c in advance, and that for the 1 out of n^n tables that are idempotent.


I'll let someone else tighten up the numerics. For strengthening Joseph's intuition, I hope this will suffice.


Gerhard "Ask Me About 2-Deficient Groupoids" Paseman, 2012.10.21


