After getting a PhD at Har-cago, Allie got a job setting up the daily Binary Operation Table on the set $\{1,2,\dots, n\}$.
Every day Allie started by choosing $1 \circ 1$ at random, with all choices equally likely. Whatever $1 \circ 1$ turned out to be, say $x$, Allie then chose at random the value of $x \circ 1$ among the legal choices. (Of course, if by luck it turned out that $x=1$, then $x \circ 1$ was already determined.)
It would be pointless to try to describe the rest of Allie's procedure, as it tended to change from day to day. But the first two steps were always as described.
After the first two steps, Allie always checked whether or not the operation was (so far) associative. If the first choice was $1\circ 1=1$ (probability: $1/n$) we have automatic associativity, that is, associativity with probability $1$.
Otherwise (probability: $1-1/n$), if $1\circ 1=x \ne 1$, the operation is associative precisely if $x \circ 1=1\circ x$. For any $x \ne 1$, this probability is $1/n$. So the probability that $(1\circ 1)\circ 1=1\circ(1\circ 1)$ is
$$\left(\frac{1}{n}\right)(1) +\left(1-\frac{1}{n}\right)\left(\frac{1}{n}\right)$$
This simplifies to $(2n-1)/n^2$.
But this probability is $\ge A_n/B_n$, where $A_n$ and $B_n$ are defined as in the post.
Thus
$$\frac{A_n}{B_n} \le \frac{2n-1}{n^2}$$
In particular, $A_n/B_n$ approaches $0$ as $n$ gets large.
The inequality we have obtained is tight at $n=1$, but absurdly weaker than the truth for large $n$. One could produce much improved estimates, and undoubtedly there is even a modest literature on the subject.
The cartesian product of two sets : $X,Y$ is a set $Z$ defined as :
$Z = \{ (x,y) \, | \, x \in X \, \text {and} \, y \in Y \}$
where $(x,y)$ is the ordered pair having $x$ as first component and $y$ as second component.
Thus, the cartesian product $X \times Y$ is the set of all ordered pairs with first component in $X$ and second component in $Y$.
A relation $R$ with domain in $X$ and range in $Y$ is a subset of the cartesian product $X \times Y$, i.e. :
$R \subseteq X \times Y$.
Thus, a relation is a set of ordered pairs.
A function $F$ is a relation satisfying the ("functionality") condition :
if $(x_1,y_1) \in F$ and $(x_1,y_2) \in F$, then $y_1=y_2$.
A binary operation $f : Y \times Y \to Y$ is a function from the cartesian product $Y \times Y$ to the set Y, i.e. a subset of $(Y \times Y) \times Y$, because it "maps" an ordered pair $(y_1,y_2)$ into an element $y_3$, with $y_i \in Y$.
You can try to clarify the definitions with some simple examples.
Let $\mathbb N = \{ 0, 1, 2, ... \}$ the set of natural numbers.
Consider the cartesian product $\mathbb N \times \mathbb N$ and :
the relation $<$ ("Less then"), i.e. $(n,m) \in L$ iff $n < m$,
the function $s$ ("Successor"), i.e. $(n,m) \in S$ iff $m=s(n)$
the (binary) operation $+$ ("Plus"), i.e. $((x,y),z) \in P$ iff $z=x+y$.
Best Answer
If $A$ and $B$ are two finite sets with $|A| = m$ and $|B| = n$ then the number of maps from $A$ to $B$ is $|B|^{|A|} = n^m$. This is because the function must be defined on each of $|A|=m$ members of $A$ and for each of those m members there are $|B|=n$ possible values. Thus, there are $$\Pi_{i=1}^{m}n=n^m$$ different possible functions from $A$ to $B$.
If we apply this to maps from $S\times S\rightarrow S$ we get $|S|^{|S\times S|}=n^{(n^2)}$.
For commutative maps, we require that $(p,q)$ and $(q,p)$ be mapped to the same value. The elements of $S\times S$ are in $1$-$1$ correspondence with the entries of a square $n\times n$ matrix. Commutative maps map an entry of the lower triangle of this matrix to the same value of the corresponding entry of the upper trianglular matrix. Therefore the domain will have cardinality $\frac{n(n+1)}{2}$ and so there will be $n^{(\frac{n(n+1)}{2})}$ commutative maps from $S\times S$ to $S.$