# How many non-isomorphic binary structures on the set of $n$ elements?

This question is originated from Fraleigh's Abstract Algebra, Ex3.34. The exercise is for the case of $n=2$. The answer is 10, and the below is my solution about it.

Let the set be $\{{ a,b \}}$. If we let $f$ be the non-identity isomorphism($f(a)=b, f(b)=a$), then 4 binary structures are invariant under $f$: If you set $a*a$ and $a*b$ then the rest are determined since $f(a)*f(a)=b*b$ and $f(a)*f(b)=b*a$. So the number of non-isomorphic binary structures is $4+ \frac {16-4} 2 = 10$.

Is there any generalization of this on $n$ elements? It seems a little complicated for me. I tried to find something on google, but I can't find out.

-
If you can compute the answer for $n = 3$ you can try looking it up in the OEIS. The obvious search terms didn't work but it may be filed under something other than "isomorphism classes of magmas." –  Qiaochu Yuan Jun 26 '11 at 14:39
Sounds extremely hard to do in general. –  David Kohler Jun 26 '11 at 21:26
@Qiaochu, computing for $n=3$ may not be so easy, at any rate if you try to do it by hand. I think we're talking about oeis.org/A001329 which says "The number of isomorphism classes of closed binary operations on a set of order n," but it also says "Number of nonisomorphic groupoids with n elements," and those "groupoids" throw me. –  Gerry Myerson Jun 26 '11 at 23:09
@Gerry: that is a now-deprecated (I think) term for magmas. –  Qiaochu Yuan Jun 26 '11 at 23:13
@Qiaochu, thanks. Hunting around the web a bit I got the impression "groupoid" was used in two different senses, and in one of those sense you only need a "partial binary operation," that is, the operation need not be defined on all pairs of elements of the underlying set. That's what threw me - if that's the kind of groupoid we're talking about, then A001329 is inappropriate. But I think OEIS is using the term in the magma sense, which is the sense relevant to this question (I think...). –  Gerry Myerson Jun 26 '11 at 23:49
If the sources are saying what I think they're saying, for $n=3$ you get 3,330.
EDIT: In a comment, Doug asks about a formula at the OEIS page. I don't think it will fit in a comment, so I'll try to write it out here. Let $${\rm fix\ }A(s_1,s_2,\dots)=\prod_{i,j\ge1}\sum_{d\mid{\rm lcm}(i,j)}(ds_d)^{s_is_j\gcd(i,j)}$$ Then $$a_n=\sum_{s_1+2s_2+\dots=n}{{\rm fix\ }A(s_1,s_2,\dots)\over1^{s_1}s_1!2^{s_2}s_2!\dots}$$