Counting racks of order n

A rack on $[n]$ can be thought of as a set of maps $(f_x)_{x \in [n]}$, where each $f_x$ is a permutation of $[n]$ such that $f_{(x)f_y} = f_y^{-1}f_xf_y$ for all $x$ and $y$. In 2013, Blackburn showed that the number of isomorphism classes of racks on $[n]$ is at least $2^{(1/4 - o(1))n^2}$ and at most $2^{(c + o(1))n^2}$, where $c \approx 1.557$; in this paper we improve the upper bound to $2^{(1/4 + o(1))n^2}$, matching the lower bound. The proof involves considering racks as loopless, edge-coloured directed multigraphs on $[n]$, where we have an edge of colour $y$ between $x$ and $z$ if and only if $(x)f_y = z$, and applying various combinatorial tools.


Introduction
A rack is a pair (X, ⊲), where X is a non-empty set and ⊲ : X × X → X is a binary operation such that: 1. For any y, z ∈ X, there exists x ∈ X such that z = x ⊲ y; 2. Whenever we have x, y, z ∈ X such that x ⊲ y = z ⊲ y, then x = z; 3. For any x, y, z ∈ X, (x ⊲ y) ⊲ z = (x ⊲ z) ⊲ (y ⊲ z).
If X is finite, we call |X| the order of the rack. Note that conditions 1 and 2 above are equivalent to the statement that for each y, the map x → x ⊲ y is a bijection on X.
As mentioned by Blackburn in [2], racks originally developed from correspondence between J.H. Conway and G.C. Wraith in 1959, while more specific structures known as quandles (which are racks such that x ⊲ x = x for all x) were introduced independently by Joyce [10] and Matveev [11] in 1982 as invariants of knots. Fenn and Rourke [4] provide a history of these concepts, while Nelson [12] gives an overview of how these structures relate to other areas of mathematics.
As a first example, note that for any set X, if we define x ⊲ y = x for all x, y ∈ X, then we obtain a rack, known as the trivial rack T X . If G is a group and ⊲ : G × G → G is defined by x ⊲ y := y −1 xy, then the resulting quandle (G, ⊲) is known as a conjugation quandle. For a further example, let A be an Abelian group and τ ∈ Aut(A) be an automorphism. If we define a binary operation ⊲ : A × A → A by x ⊲ y = (x)τ + y − (y)τ = (x − y)τ + y then (G, ⊲) = (A, τ ) is an Alexander quandle or affine quandle. 1 Let (X, ⊲) and (X ′ , ⊲ ′ ) be racks. A map φ : X → X ′ is a rack homomorphism if (x ⊲ y)φ = (x)φ ⊲ ′ (y)φ for all x, y ∈ X. A bijective homomorphism is an isomorphism.
We will only be concerned with racks up to isomorphism. If (X, ⊲) is a rack of order n, then it is clearly isomorphic to a rack on [n], so we will take [n] to be our underlying ground set. We will denote the set of all racks on [n] by R n , and the set of all isomorphism classes of racks of order n by R ′ n , so |R ′ n | |R n |. There have been several published results concerning the enumeration of quandles of small order; Ho and Nelson [6] and Henderson, Macedo and Nelson [5] enumerated the isomorphism classes of quandles of order at most 8, while work of Clauwens [3] and Vendramin [13] gives an enumeration of isomorphism classes of quandles of order at most 35 whose operator group is transitive (the operator group is defined in Section 2). Recently, Jedlička, Pilitowska, Stanovskỳ and Zamojska-Dzienio [9] gave an enumeration of medial quandles (a type of affine quandle) of order at most 13. As far as we are aware, the only previous asymptotic enumeration result for general racks was due to Blackburn [2], giving lower and upper bounds for |R ′ n | of 2 (1/4+o(1))n 2 and 2 (c+o(1))n 2 respectively, where c ≈ 1.557. Theorem 8.2 of [9] improves the upper bound to 2 (1/2+o(1))n 2 in the case of medial quandles; the authors then conjecture an upper bound of 2 (1/4+o(1))n 2 under the same restriction. The main result of this paper proves this upper bound for general racks, and hence for (medial) quandles. Theorem 1.1. Let ǫ > 0. Then for all sufficiently large integers n, 2 (1/4−ǫ)n 2 |R ′ n | |R n | 2 (1/4+ǫ)n 2 . The lower bound follows from the construction in Theorem 4 of [2]; our focus is on the upper bound. The bound given in Theorem 12 of [2] was obtained by applying group theoretic results to the operator group associated with a rack; in our arguments we apply combinatorial results to a graph associated with a rack. This graph is defined in the next section.

Graphical representations of racks
For any rack (X, ⊲), we can define a set of bijections (f y ) y∈X by setting (x)f y = x⊲y for all x and y. The following well-known result (see for example, [4], [2]) gives the correct conditions for a collection of maps (f y ) y∈X to define a rack. Proposition 2.1. Let X be a set and let (f x ) x∈X be a collection of functions each with domain and co-domain X. Define a binary operation ⊲ : X × X → X by x ⊲ y := (x)f y . Then (X, ⊲) is a rack if and only if f y is a bijection for each y ∈ X, and for all y, z ∈ X we have Proof. As noted earlier, conditions 1 and 2 in the definition of a rack hold if and only if each f y is a bijection, so it remains to show that condition 3 is equivalent to (2.1). This is essentially a reworking of the definition; we omit the simple details.
In the light of Proposition 2.1, we can just as well define a rack on a set X by the set of maps (f y ) y∈X , providing they are all bijections and satisfy (2.1). We will move freely between the two definitions, with x ⊲ y = (x)f y for all x, y ∈ X unless otherwise stated.
The operator group of a rack is the subgroup of Sym(X) generated by (f y ) y∈X . The following standard lemma (see for example Lemma 6 of [2]) shows that Proposition 2.1 can be extended to elements of the operator group.
Lemma 2.2. Let (X, ⊲) be a rack and let G be its operator group. Then for any y ∈ X and g ∈ G, f (y)g = g −1 f y g.
Any rack on X can be represented by a directed multigraph on X; we give each vertex a colour and then put a directed edge of colour i from vertex j to vertex k if and only if (j)f i = k. We then remove all loops from the graph; i.e. if (j)f i = j we don't have an edge of colour i incident to j.
It will be helpful to recast the representation of racks by directed multigraphs in a slightly different setting. Let V be a finite set and let σ ∈ Sym(V ); then we can define a simple, loopless directed graph G σ on V by setting − → uv ∈ − → E (G σ ) if and only if u = v and (u)σ = v. By considering the decomposition of σ into disjoint cycles, we see that G σ consists of a collection of disjoint directed cycles, isolated double edges corresponding to cycles of length two, and some isolated vertices. We can now extend this definition to the case of multiple permutations in a natural way.
We also define the reduced graph G 0 Σ to be the directed graph on V obtained by letting e = − → uv ∈ − → E (G 0 Σ ) if and only if there is at least one directed edge from u to v in G Σ .
Note that the reduced graph contains at most two edges between any u, v ∈ V , namely − → uv and − → vu. Also observe that if Σ ′ ⊆ Σ, then G Σ ′ is a subgraph of G Σ .
Before continuing, let us clarify some terminology. A path in a directed multigraph G need not respect the orientation of the edges, so for x, y ∈ V (G), there is an xy-path in G if and only if there is an xy-path in the underlying undirected graph. A component of a directed graph G is defined to be a component of the underlying undirected graph. For x, y ∈ V (G), a directed xy-path is a sequence of vertices x = x 0 , . . . , x r = y such that − −−− → x i x i+1 ∈ − → E (G) for all i. Now let us return specifically to racks. Definition 2.4. Let R = (X, ⊲) be a rack, and let (f y ) y∈X be the associated maps. For any S ⊆ X, define Σ S = {f y | y ∈ S}. Then by G S we mean the directed multigraph G Σ S in the sense of Definition 2.3; G S thus has an associated |S|-edge-colouring, although if |S| = 1 we may not necessarily consider G S as being coloured. We will also write G R = G X , indicating the graph for the whole rack.
When describing racks on [n] in a graphical context, we may refer to elements of [n] as vertices. The following two observations are straightforward but crucial.  Proof. Let u, v ∈ V . Then u and v are in the same orbit of the natural action if and only if there exists a sequence (σ i 1 , . . . , σ im ) of elements from Σ and a sequence (ǫ 1 , . . . , ǫ m ) ∈ {−1, 1} m such that v = (u)σ ǫ 1 i 1 · · · σ ǫm im . But this is exactly equivalent to there being a uv-path in G Σ with edges successively coloured i 1 , . . . , i m , and the value of ǫ i indicating the direction of the edge. Thus the partition of V into orbits of Σ coincides with the partition of V into components of G Σ .
Applying this last result to a rack R on [n] shows that the orbits of the operator group (in its natural action on [n]) coincide with the components of G R .
We can illustrate these notions with a simple example. Let (X, ⊲) be a rack; then a subrack of (X, ⊲) is a rack (Y, ⊲| Y ×Y ) 2 where Y ⊆ X. Thus a subset Y ⊆ X forms a subrack if and only if for all y, z ∈ Y , (z)f y ∈ Y ; as each f y is a bijection we then also have that (z)f −1 y ∈ Y for all z and thus Y and X \ Y are separated in the graph G Y .

Outline of the proof
In this short section we give a brief outline of how we will count the number of racks on [n]. We shall reveal information about an unknown rack on [n] in several steps, counting the number of possibilities for the revealed information at each step. At the end the rack will have been determined completely, so we obtain an upper bound on the number of racks.
The principle behind the argument is as follows: we choose a set T ⊆ [n] and reveal the maps (f j ) j∈T . We then consider the components of the graph G T ; a key lemma shows that if V is a set of vertices such that each component contains precisely one element from V , then revealing the maps (f v ) v∈V determines the entire rack R. The difficulty is in finding a set T which is not too big, but such that G T has relatively few components.
We will actually need to consider two different sets T and W . We choose a threshold ∆ and first consider the set of vertices S >∆ that have degree strictly greater than ∆ in the underlying graph G 0 R ; we will choose probabilistically a relatively small set W ⊆ [n] such that any vertex with high degree in G 0 R also has high degree in G 0 W . Because the degree of any vertex in S >∆ is so high, the number of components of G 0 W contained in S >∆ is small; this allows us to determine the maps (f s ) s∈S >∆ .
For the vertices in S ∆ (those with degree at most ∆ in G 0 R ), we will construct greedily a set T of a given size by adding vertices one at a time and revealing their corresponding maps, each time choosing the vertex whose map joins up the most components. It will follow that for every j ∈ S ∆ \ T , f j can only join up a limited number of components of G T ; we will reveal the restriction of f j to these components.
Because of the complex nature of this argument, we will 'store' these revealed maps in a 7-tuple I = I(R), and then count the racks consistent with I. The main term in the argument comes from considering maps in S ∆ \ T acting within components of G T ; we can control the action of these maps by first revealing some extra information corresponding to the neighbours of T in G 0 R , which can themselves be controlled as T consists of low degree vertices.
In Section 4 we formally define the information I(R), which requires some straightforward graph theory; in Section 5 we show that the number of possibilities for I is at most 2 o(n 2 ) . In Section 6 we will complete the proof of Theorem 1.1.

Degrees in graphical representations of racks
Definition 4.1. With notation as above, the out-degree of v (with respect to T ) We can of course define the in-degree d − T (v) similarly. We now show that when S is a subrack, then all components of G 0 S are out-regular.
Take an arbitrary w ∈ Γ + S (u), so w = u and there exists a j ∈ S such that w = (u)f j ; as S is a subrack, , and the result follows.

Some multigraph theory
The construction of the information I(R) requires some straightforward graph theory. Here, a multigraph G = (V, E) is defined by a vertex set V = V (G) and an edge multiset E = E(G) of unordered pairs from V . For multisets A and B, A ⊎ B is the multiset obtained by including each element e with multiplicity m, where m is the sum of the multiplicity of e in A and the multiplicity of e in B.
In this subsection we will consider only undirected multigraphs for clarity. As paths and components of a directed multigraph are defined by the underlying undirected multigraph, all of these results remain true for directed multigraphs. We will write cp(G) for the number of components of a multigraph G.
Let G be a multigraph 3 . Then for distinct u, v ∈ V (G) we have that cp(G + {uv}) = cp(G) − 1 if and only if there is no uv-path in G. The following result is standard. Proposition 4.3. Let G be a multigraph and E 1 and E 2 be multisets of unordered pairs of elements of V (G).
Proof. The case where |E 2 | = 1 follows from the above observation, since there is a uv-path in G + E 1 if there is a uv-path in G. The general case now follows by induction.
Definition 4.4. Let G be a multigraph and E be a multiset of unordered pairs We denote by M (G, E) the set of (vertex sets of) components of G merged by E.
Note that for multisets of edges E and F , As a single edge can merge at most two components, |M (G, {e})| 2 for any unordered pair e.  Proof. Order E as {e 1 , . . . , e l } and write a = cp(G)−cp(G+E); then there are precisely a edges e i 1 , . . . , e ia such that cp(G+{e 1 , . . . , e i j }) = cp(G+{e 1 , . . . , . Now consider adding the edges of E in the order given to G; if k = i j for any j then cp(G, E k ) = cp(G, E k−1 ) and so from Lemma 4.5 we have that

The information I(R)
We introduce the following terminology. For any rack R = ([n], ⊲) and any ∆ with for the set of all vertices with out-degree strictly greater than ∆. We now show that this partition is actually a partition into subracks.  We now introduce some more notation. For any j ∈ [n], write − → E j = − → E (G {j} ) for the set of edges of G R of colour j and for the set of (vertex sets of) components of G T (R) merged by the edges of colour ) and so M j = ∅. The key property of the set T (R) is given in the next lemma.
, and so x i 0 for each i; we also have that Now fix an i and suppose that x i < x i+1 ; then , contradicting our ordering of the vertices. Hence x i x i+1 , and as i was arbitrary we conclude that (x i ) s i=1 is a decreasing sequence. From this and the fact that We can combine this with Corollary 4.6 to see that showing the result.
Before formally defining the information I(R) associated with a rack R, we will need some more notation. Firstly, write For any j ∈ S ∆ (R) \ T (R), define to be the set of vertices in components of G T (R) merged by − → E j , and write (see Figure 1). The following lemma gives the key property of the set Z j , in a slightly more general setting.
Proof. Take a set C as described and let x ∈ C be arbitrary. If (x)f j = y = x then − → xy is an edge of colour j; as C is not merged by − → E j , we must have (x)f j = y ∈ C and (as x was arbitrary and f j is a bijection) it follows that (C)f j = C. Now apply this lemma with W = T (R); for any C ⊆ [n] spanning a component of G T (R) with C / ∈ M j , (C)f j = C. As Z j consists of all vertices in components of G T (R) not merged by − → E j , we have that (Z j )f j = Z j , and thus that (Y j )f j = Y j . We will now formally define the information associated with a rack R. where we order the vertices in some arbitrary way, and let As i ⊲ j = (i)f j , the second entry of this 7-tuple is equivalent to the set of maps (f j ) j∈S >∆ (R) or alternatively the graph G S >∆ (R) . The fourth entry is equivalent to the set of maps (f j | T (R) ) j∈[n] ; from Lemma 4.7, the image of each of these maps is contained within S ∆ (R). Knowing the fourth entry determines Γ + R (T (R)), which is necessary for the fifth entry. Note also that the fifth entry is equivalent to the set of maps (f j ) j∈T + (R) and thus the graph G T + (R) , while the seventh entry is equivalent to (f j | Y j ) j∈S ∆ (R)\T (R) .
We will think of I as a map from R n to a set of 7-tuples; the form of this set will be considered in more detail in Section 6. In the next section, we show that the image I(R n ) is small. We will do this by first considering the map I ′ , where I ′ (R) = (I 1 (R), I 2 (R)) and then I ′′ , where I ′′ (R) = (I 3 (R), . . . , I 7 (R)).

Random subsets
The part of the argument relating to the vertices of high degree requires some probabilistic tools. In particular, we will require a result of Hoeffding [7] known as the Chernoff bounds; we will use the following, more workable version (see for example Theorems 2.1 and 2.8 and Corollary 2.3 of [8]). Let R = ([n], ⊲) be a rack. To ease notation, we write d Proof. For each j, let X j = 1 {j∈X} , so that each X j ∼ Ber(p) and the variables (X j ) n j=1 are independent. Then |X| = n j=1 X j ∼ Bi(n, p) and E[X] = np, so we can apply Theorem 5.1 to |X|, showing the first statement.
For the second statement, take a vertex v ∈ [n] and let v 1 , . . . , v d + v be the out-neighbours of v in G 0 R ; for each 1 i d + v , choose an element j vi ∈ [n] such that (v)f j vi = v i and put The elements j v1 , . . . , j vd + v are clearly distinct and so and we can apply Theorem 5.1 to see that for any 0 < δ d + v p, Since d + X (v) |J v ∩ X|, the second result follows.

The high degree part
We will need the following crucial lemma. Proof. Let u ∈ C, so from Lemma 2.5 there is a directed vu-path in G T . Let the colours of the edges of this path be i 1 , . . . , i l , so (v)f i 1 · · · f i l = u and thus from But as each i j ∈ T , all of these maps are determined and thus f u | A is determined. Also note that f u | A is conjugate to f v | A by the map (f i 1 · · · f i l )| A , proving the result.
We will now show the first main result of this section. such that I ′ (R) = (I 1 (R), I 2 (R)) is determined by the sets S ∆ (R) and W and the maps (f i ) i∈W .
Proof. We will construct the set W by a mixture of probabilistic and deterministic arguments. Let p = (log 2 n) −3/2 and consider a random subset X of [n] as described in Lemma 5.2. Let E be the event that |X| 3np/2; from item 1 of the lemma (with ǫ = 1/2) we have that P(E c ) P(|X| 3np/2) e −np/12 .
Since np → ∞ as n → ∞, it follows that P( hence from item 2 of Lemma 5.2 (with ǫ = 1/2 and δ = ∆p), Let F be the event that N = 0, i.e. that every vertex in S >∆ is X-good. Then from Markov's Inequality If n is large enough, then P(E c ∪ F c ) < 1/2 + 1/2 = 1, and thus P(E ∩ F) > 0. Hence we can find a set U ⊆ [n] such that |U | 3np/2 and each vertex in S >∆ is U -good; this means that d + U (v) > (log 2 n) 3/2 /2 whenever v ∈ S >∆ , or in graphical terms, that each vertex v ∈ S >∆ is adjacent to at least (log 2 n) 3/2 /2 vertices in G 0 U . Now from Lemma 4.7 there are no edges from S >∆ to S ∆ = [n] \ S >∆ , so S >∆ is a disjoint union of vertex sets of components of G 0 U . Each component of G 0 U contained within S >∆ has size at least (log 2 n) 3/2 /2 + 1 and hence there are at most 2|S >∆ |(log 2 n) −3/2 such components. Write the vertex sets of these components as {C 1 , . . . , C r } and take a set of vertices V = {v 1 , . . . , v r } such that v k ∈ C k for each k; we have shown that |V | = r 2n (log 2 n) 3/2 . Now from Lemma 5.3 (with T = U and A = [n]), knowledge of the maps (f i ) i∈U and f v k is sufficient to determine the maps (f u ) u∈C k ; applying this to each component in turn shows that knowledge of the maps (f i ) i∈U and (f v ) v∈V is sufficient to determine (f u ) u∈S >∆ , i.e. the second entry of I ′ (R). So put W = U ∪ V ; as |U | 3n(log 2 n) −3/2 /2 we have the result.
Proof. Take n sufficiently large for the previous result to hold; then I ′ (R) is determined by S ∆ (R) (or equivalently S >∆ (R)), W and the maps (f i ) i∈W for a suitable set W depending on R, with |W | w 0 (n). Now fix such an n; it follows that |I ′ (R n )| is at most the number of distinct triples (S ∆ (R), W, (f i ) i∈W ) arising from all racks in R n . There are clearly at most 2 n possibilities for each of S ∆ (R) and W ; as there are n! n n choices for any map f i , and |W | w 0 (n), there are at most n nw 0 (n) possibilities for the maps (f i ) i∈W . Hence |I ′ (R n )| 2 2n n nw 0 (n) , and from (5.1) we have that log 2 2 2n n nw 0 (n) = 2n + n(log 2 n)w 0 (n) = 2n + n(log 2 n) 7 2 n (log 2 n) 3/2 = 2n + 7 2 Hence for any ǫ > 0, there exists a positive integer n 1 such that for n n 1 , |I ′ (R n )| 2 2n n nw 0 2 ǫn 2 .

Components of the graph G T (R)
In order to prove that there are few choices for I ′′ (R) = (I 3 (R), . . . , I 7 (R)), we will need the following lemma. Recall that T (R) ⊆ S ∆ (R) is defined in Construction 4.8 and that T + (R) = T (R) ∪ Γ + R (T (R)). and (f i ) i∈T + (R) and the vertex (v)f j is sufficient to determine the map f j | C .
As in Definition 4.11, the maps (f l | T (R) ) l∈[n] determine the set Γ + R (T (R)) and thus the set T + (R).
Proof. Let u ∈ C; from Lemma 2.5 there is a directed vu-path in G T (R) (note that this graph is determined from the maps (f i ) i∈T (R) , knowledge of which is assumed). Let − → d (v, u) denote the length of the shortest directed vu-path; we will show that (u)f j is determined by induction on the graph distance d = − → d (v, u). The base case d = 0 is true by assumption, so take d > 0 and suppose the result is true for smaller d.
Take a shortest directed path (of length d) from v to u and let w be the penultimate vertex on the path; then − → wu is an edge in G T (R) , so there exists some i ∈ T (R) such that (w)f i = u. As we know f j | T (R) , k := (i)f j is determined; as k ∈ T (R) ∪ Γ + R (T (R)) = T + (R), the map f k is also determined. Further, − → d (v, w) = d − 1, so by the inductive hypothesis the vertex (w)f j is determined.
which is determined as we know the vertex (w)f j and the map f k . The result follows by induction.
We can now show the second main result of this section.
Proof. As in Corollary 5.5, |I ′′ (R n )| is equal to the number of distinct values of the 5-tuple I ′′ (R) as R ranges over all racks of order n; we will produce bounds for each of these entries. There are clearly at most 2 n choices for the set T (R); recall that by construction |T (R)| L = ⌊(log 2 n) 2 ⌋ and that L∆ and thus that |T + (R)| L + L∆. There are at most n possibilities for the vertex (u)f i for any i, u ∈ [n], so there are at most (n L ) n possibilities for the maps (f j | T (R) ) j∈[n] and at most (n n ) L+L∆ possibilities for the maps (f i ) i∈T + (R) ; hence there are at most 2 n n (2+∆)Ln possible values for the first three entries of I ′′ (R) (as R ranges over all racks of order n).
Now consider a rack R ∈ R n and suppose that the first three entries of I ′′ (R) have been determined. Fix a j ∈ S ∆ (R)\T (R); we must consider the possibilities for the set M j of components of G T (R) merged by − → E j , and the restricted map f j | C for each C ∈ M j . If |M j | = a j then there are (crudely) at most n a j possibilities for M j , as there are at most n components of G T (R) ; from Lemma 4.9, a j = |M j | 2n(log 2 n) −2 , so the number of possibilities for M j is at most n a j 1 + 2n (log 2 n) 2 n 2n(log 2 n) −2 3n · n 2n(log 2 n) −2 , for sufficiently large n. Now take a C ∈ M j and choose an arbitrary v ∈ C; as the maps (f l | T (R) ) l∈[n] and (f i ) i∈T + (R) have been determined already, we have from Lemma 5.6 that the restriction f j | C is determined entirely by (v)f j . There are at most n possibilities for this vertex, and so considering the |M j | components making up Y j , there are at most n |M j | n 2n(log 2 n) −2 possibilities for the restriction f j | Y j . Now note that M and ⊲| Y are determined by M j and f j | Y j for each j ∈ S ∆ (R) \ T (R); as there are at most n such elements regardless of the set S ∆ (R), there are at most (3n) n n 2n 2 (log 2 n) −2 possibilities for M and at most n 2n 2 (log 2 n) −2 possibilities for ⊲| Y . Combining these bounds, there are at most possibilities for I ′′ (R) as R ranges over all racks of order n, for n sufficiently large, and thus |I ′′ (R n )| Λ n .
Hence for any ǫ > 0, there exists a positive integer n 2 such that for n n 2 , |I ′′ (R n )| Λ n 2 ǫn 2 , proving the result.
6 Maps acting within components of G T (R)
The above claim is used to prove the following key technical lemma. The notation is chosen to match the quantities defined in the next subsection. where d q := 1/4 − (log 2 q)/q 2 and c p,q := 1/2 − (log 2 (pq))/pq. Since 2 r r 2 for all positive integers r = 3, c p,q 0 for (p, q) = (1, 3). Similarly, 2 r 2 r 4 for all positive integers r and thus d q 0 for all q; hence We can bound this sum from below by using Claim 6.1 with x = η 3 and y = η 1 ; we have that A more elaborate version of this argument gives a corresponding stability result, saying (informally speaking) that ζ is close to n 2 /4 if and only if η 2 is close to n and η q is close to 0 for all q = 2; for full details see [1].

Proof of Theorem 1.1
At the end of Section 4, we introduced the information I(R) in a rack R on [n], and explained how I can be thought of as a map from R n to a set of 7-tuples; let us call this set I n . In Section 5 we showed that the image I(R n ) ⊆ I n has size at most 2 o(n 2 ) ; in this section, we will fix an I in this image and consider all racks R ∈ R n such that I(R) = I. We will show that once the information corresponding to I is known, there are not too many possibilities for R.
We will first consider the set I n of 7-tuples in more detail. From Definition 4.11 and the subsequent discussion, each I = (I 1 , . . . , I 7 ) ∈ I n has the form described below. The last two entries of I(R) are graphical in nature; to relate them to an abstract I ∈ I n we will formally define the graph associated with such a 7-tuple I. We can now describe the form of I 6 and I 7 , namely: 6. I 6 is a sequence (M I j ) of subsets of C I , indexed by S I \ T I in some arbitrary order; To avoid later inconvenience, we will extend the definition of M I j and Y I j to all j ∈ [n] as follows. For each j ∈S I ∪ T I , define a set of ordered pairs from [n] (which we can think of as edges of colour j) by setting where each entry defined by ⊲ can also be determined in terms of the maps f 1 , . . . , f n corresponding to R. Comparing I(R) with I we see that S ∆ (R) = S I , S >∆ (R) =S I and T (R) = T I . We also have that f j = σ I j for j ∈S I ∪ (T I ) + , and thus G T (R) = G I . Finally, M I j = M j and Y I j = Y j for all j ∈ [n], and f j | Y j = ψ I j for j ∈ S I \ T I . This means that if the information I = I(R) is known, we need only determine the maps (f j | Z j ) j∈S ∆ (R)\T (R) to determine the entire rack R, noting that for each j ∈ [n], the set Z j = [n] \ Y j = [n] \ Y I j is determined by I. It follows that an upper bound on the number of possibilities for these maps is also an upper bound for the number of racks R such that I(R) = I.
We can further reduce the number of maps left to determine by considering components of the graph G I . Lemma 6.4. Let I ∈ I n be fixed and let R ∈ R n be a rack such that I(R) = I. Let C I = {C 1 , . . . , C c I } and let V = {v 1 , . . . , v c I } be a set of vertices such that v j ∈ C j for each j. Then R is determined by I and the maps (f v | Zv ) v∈V .
Proof. As I(R) = I, we have that G T (R) = G I and so the set of (vertex sets of) components of T (R) is C I . Take any j = 1, . . . , c I ; the knowledge of I determines the maps (f i ) i∈T (R) = (σ I i ) i∈T I and thus from Lemma 5.3 (with A = [n]) knowledge of the map f v j is sufficient to determine the maps (f u ) u∈C j . Applying this over all the components of G T (R) shows that we can determine the entire rack R by determining the set of maps (f v ) v∈V . As the restrictions (f v | Yv ) v∈V are determined by I (f v | Yv = f v | Y I v is equal to ψ I v if v ∈ S I \ T I and to σ I v | Y I v otherwise), we need only determine the restrictions (f v | Zv ) v∈V .
Before proving an upper bound we will need some more notation. For I ∈ I n and 1 q n, let η I q denote the number of vertices in components of G I of size exactly q. Then there are η I q /q components of size exactly q and thus n = Then there are at most 2 ζ I racks R ∈ R n such that I(R) = I.
Proof. Write C I = {C 1 , . . . , C c I } and let V = {v 1 , . . . , v c I } be a set of vertices such that v j ∈ C j for each j. Let R ∈ R n be a rack such that I(R) = I; from Lemma 6.4, R is determined by I and the maps (f v | Zv ) v∈V . It follows that an upper bound on the number of possibilities for the maps (f v | Zv ) v∈V is also an upper bound for the number of racks R such that I(R) = I. This proposition allows us to prove the main result.
Proof of Theorem 1.1. Recall that R ′ n denotes the set of isomorphism classes of racks of order n; as |R ′ n | |R n | it suffices to find an upper bound on |R n |. Let ǫ > 0; we have from Corollary 5.5 and Proposition 5.7 that for n sufficiently large |I ′ (R n )| 2 ǫn 2 /2 and |I ′′ (R n )| 2 ǫn 2 /2 . Now take such a sufficiently large n; as I(R) = (I ′ (R), I ′′ (R)) for any R ∈ R n , |I(R n )| |I ′ (R n )||I ′′ (R n )| 2 ǫn 2 , and so there are at most 2 ǫn 2 possibilities for the 7-tuple I ∈ I(R n ). From Proposition 6.5 and Lemma 6.2, there are at most 2 ζ I 2 n 2 /4 racks R such that I(R) = I, and thus |R n | 2 ǫn 2 2 n 2 /4 .

An extremal result
For each positive integer n, let P n be a partition of [n], and let R Pn denote the set of racks R on [n] such that the components of G R are exactly the parts of P n . Let m 2 (n) denote the number of parts of P n of size exactly two; an extension of the methods used in this paper can be used to prove that unless m 2 (n) ∼ n/2 there exists a constant 0 < κ < 1/4 such that |R Pn | 2 κn 2 for infinitely many n. In other words, informally speaking, almost all (in an exponentially strong sense) racks R on [n] are such that almost all components of G R have size 2. The idea of the proof is to find a function similar to ζ from Proposition 6.5, but taking into account the size of the components of G R rather than G T (R) ; the components of size two are a special case as the symmetric group on two elements is small and abelian. For a full proof, see [1].