Given a finite set, how to generate all possible groups defined on it? Just started learning algebra, the "group" concept looks simple but more thoughts are needed.
Given a finite set $S$, say, with $n$ elements, how can we generate all possible groups on $S$? Is there a formula for the number of possible group structures on $S$?
For example, if $n=1$, then $S=\{e\}$, there's only one possible definition:
$$e e = e.$$
If $n=2$, then $S=\{e,a \}$, there's also only one possible definition:
$$e e = e, \qquad e a = a ,\\ a e = a, \qquad a a = e.$$
If $n=3$, then $S=\{e,a,b \}$, there's again only one possible definition: $$e e = e, \qquad e a = a , \qquad e b = b, \\ a e = a, \qquad a a = b, \qquad a b = e, \\ b e = b, \qquad b a = e, \qquad b b = a.$$
 A: Note that there are two closely related possible questions here:
First, given a finite set $S$ of $n$ elements, one can ask for the all of the group structures $S \times S \to S$ on $S$: For example, on the set $S$ with two elements $a, b$, there are precisely two group structures, namely those defined by the multiplication tables
$$
\begin{array}{c|cc}
\ast & a & b \\
\hline
a & a & b \\
b & b & a
\end{array}
\qquad
\begin{array}{c|cc}
\star & a & b \\
\hline
a & b & a \\
b & a & b
\end{array}
.$$
On the other hand, these two structures are isomorphic, that is, even though their multiplication tables are different, they have the same underlying structure: Informally, the operation $\star: S \times S \to S$ defined by the second table looks just like the first one provided we relabel $a$ as $b$ and $b$ as $a$. Put more precisely, two groups, $(G, \ast)$ and $(H, \star)$, are isomorphic if there is a bijection $\phi: G \to H$ that maps one operation onto the other, that is, that satisfies
$$\phi(g_1 \ast g_2) = \phi(g_1) \star \phi(g_2)$$
for all $g_1, g_2 \in G$, in which case we call $\phi$ a (group) isomorphism.
So, in determining the number of possible group structures on $S$, we might like to count isomorphic structures as the same structure, and this is what is more commonly done, and what we'll assume here henceforth. Note that since we are only enumerating groups up to isomorphism, the count doesn't depend on the elements of $S$, but rather just its cardinality, that is, how many elements it contains.
Anyway, the number $\lambda_n$ of nonisomorphic groups of order $n$ does not follow any obvious pattern, but it obeys many identifiable rules (for a particularly simple example, for any prime $p$ we have $\lambda_p = 1$, and the only group of that order is $Z_p$). One can often work out by hand $\lambda_n$ for $n$ that aren't too large (more to the point, this tends to be more manageable when $n$ doesn't isn't divisible by a large power of a prime), and generally also classify the groups themselves. See this subsection of the Wikipedia article Finite group for a little more about this and references for the techniques involved in working these out, most notable the Sylow Theorems. The sequence $\{\lambda_n\}$ is exactly the subject of OEIS A000001; for more see this list of the counts $\lambda_n$ for all $n \leq 2^{11}$.
It's not too hard to work out $\lambda_n$ and describe the possible groups (up to isomorphism) for $n < 16$:
\begin{array}{ccl}
 n & \lambda_n & \text{isomorphism classes} \\
\hline
 1 & 1 & Z_1\\
 2 & 1 & Z_2\\
 3 & 1 & Z_3\\
 4 & 2 & Z_2 \times Z_2, Z_4\\
 5 & 1 & Z_5\\
 6 & 2 & Z_6, \color{red}{S_3}\\
 7 & 1 & Z_7\\
 8 & 5 & Z_2 \times Z_2 \times Z_2, Z_2 \times Z_4, Z_8, \color{red}{D_8}, \color{red}{Q_8}\\
 9 & 2 & Z_3 \times Z_3, Z_9\\
10 & 2 & Z_{10}, \color{red}{D_{10}}\\
11 & 1 & Z_{11}\\
12 & 5 & Z_2 \times Z_6, Z_{12}, \color{red}{Z_3 \rightthreetimes Z_4}, \color{red}{A_4}, \color{red}{D_6}\\
13 & 1 & Z_{13}\\
14 & 2 & Z_{14}, \color{red}{D_{14}}\\
15 & 1 & Z_{15}
\end{array}
(The groups in red are precisely the nonabelian ones.)
Already for $n = 16$ the classification problem is more complicated. See for example, Marcel Wild's accessible The Groups of Order Sixteen Made Easy (American Mathematical Monthly, Jan. 2005), which proves that $\lambda_{16} = 14$ and lists the groups explicitly, and takes about 11 pages to do so.
The Wikipedia article List of small groups extends the above table to $n \leq 30$ (actually, it splits the list into separate tables of abelian and nonabelian groups).
For larger $n$, there are available databases of (isomorphism types of) finite groups. For example, the computer algebra system GAP contains the Small Groups library includes explicit descriptions of many finite groups, including all groups of order $< 2000$, except some of the groups of order $n = 1024$. (This exclusion is perhaps initially surprising, but it turns out that $\lambda_{1024} \approx 4.95 \cdot 10^{10}$, and groups of this order together account for $> 99\%$ of all isomorphism types of groups of order $< 2000$.)
Some finite groups can be built out of smaller finite groups in some ways; Cartesian products, a few of which occur in the above list, are the simplest examples of these constructions. Some finite groups, aptly called simple groups (roughly speaking) cannot be built out of smaller groups, much like the prime numbers among the integers. Classifying the finite simple groups was a decades-long project that involved hundreds of papers running to thousands of pages, and by some measure it was only completed in 2008. In summary, all finite simple groups are members of one of 18 (depending on how one counts it) infinite families of groups, including the prime cyclic groups $Z_p$ for $p$ prime and the alternating groups $A_n$, $n \geq 5$, with the exception of precisely 26 so-called sporadic groups (see Wikipedia's List of finite simple groups). The largest of the sporadic groups is the famous Monster Group $M$, which has order $\approx 8.08 \cdot 10^{53}$, and it enjoys surprising connections with some very deep and beautiful mathematics.
