Counting numerical semigroups by Frobenius number, multiplicity, and depth

In 1990, Backelin showed that the number of numerical semigroups with Frobenius number $f$ approaches $C_i \cdot 2^{f/2}$ for constants $C_0$ and $C_1$ depending on the parity of $f$. In this paper, we generalize this result to semigroups of arbitrary depth by showing there are $\lfloor{(q+1)^2/4}\rfloor^{f/(2q-2)+o(f)}$ semigroups with Frobenius number $f$ and depth $q$. More generally, for fixed $q \geq 3$, we show that, given $(q-1)m<f<qm$, the number of numerical semigroups with Frobenius number $f$ and multiplicity $m$ is\[\left(\left\lfloor \frac{(q+2)^2}{4} \right\rfloor^{\alpha/2} \left \lfloor \frac{(q+1)^2}{4} \right\rfloor^{(1-\alpha)/2}\right)^{m + o(m)}\] where $\alpha = f/m - (q-1)$. Among other things, these results imply Backelin's result, strengthen bounds on $C_i$, characterize the limiting distribution of multiplicity and genus with respect to Frobenius number, and resolve a recent conjecture of Singhal on the number of semigroups with fixed Frobenius number and maximal embedding dimension.


Introduction
A numerical semigroup Λ is a subset of the nonnegative integers N 0 that has finite complement and is also an additive monoid, that is, it contains 0 and is closed under addition.Numerical semigroups were first studied by Frobenius and Sylvester in the context of the Frobenius coin problem, and more recently have been of interest in constructions in algebraic geometry.See [11,15] for more background.Given a numerical semigroup Λ, one can define its genus g(Λ) := #(N 0 \ Λ); its multiplicity m(Λ) := min(Λ \ {0}); its conductor c(Λ) := min{c ∈ N 0 : c + N 0 ⊆ Λ}; its Frobenius number f (Λ) := c(Λ) − 1; and its depth q(Λ) = ⌈c(Λ)/m(Λ)⌉, the last of which was recently introduced by Eliahou and Fromentin [8].
A central problem in the study of numerical semigroups is enumeration after ordering by a specific invariant.For instance, in 2011, Zhai [17] proved that the number of numerical semigroups with genus g is asymptotically , where C is a positive constant, settling two conjectures of Bras-Amorós [6].In 1990, Backelin [2] estimated the number Fr(f ) of numerical semigroups with Frobenius number f , answering a question of Wilf: Theorem 1.1 (Backelin [2, Prop.1]).There are constants C 0 and C 1 for which A key ingredient in both of these proofs is that, after ordering, almost all numerical semigroups have small depth.Zhai shows that numerical semigroups with genus g are almost all of depth 2 or 3; Backelin shows that numerical semigroups with Frobenius number f are almost all of depth 2, 3, or 4. They then estimate the number of numerical semigroups with these depths.For instance, letting Fr q (f ) denote the number of numerical semigroups with Frobenius number f and depth q, Backelin shows the following enumerative result.Proposition 1.2 (Backelin [2, pg. 202]).We have Fr 2 (f ) + Fr 3 (f ) + Fr 4 (f ) ≤ 3 • 2 ⌊(f −1)/2⌋ .
It is natural to consider the number of numerical semigroups of larger depth, especially since such bounds would sharpen the results of Zhai and Backelin to lower-order terms.For instance, in 2023, Zhu [19] proves the sharpest known asymptotics of the number of numerical semigroups by bounding the number of semigroups of depth at least 4, refining estimates of Bacher [1].
In the realm of Frobenius numbers, Backelin [2, eq. 13, eq. 15] proves Theorem 1.1 by bounding on the number of numerical semigroups with depths 3, 4, and at least 5.In particular, Backelin shows that the number of depth-3 and depth-4 numerical semigroups with Frobenius number f and multiplicity m is at most 1 2 (11/6) ⌊(f −3)/2⌋ (12/11) m .The results of Backelin have since remained the best bounds on the number of numerical semigroups of large depth, but unfortunately they are not sharp.The bottleneck seems to be that numerical semigroups of large depth are significantly more challenging to characterize than semigroups of depth 2 and 3.
To aid with computation, Blanco and Rosales [4] develop algorithms to compute the number of numerical semigroups with fixed Frobenius number, and recently Branco, Ojeda, and Rosales [5] developed algorithms to compute the number of numerical semigroups with fixed multiplicity and Frobenius number.However, enumerations for small f and m say little about the behavior as these invariants grow large.
In this paper, we determine the number of numerical semigroups with fixed Frobenius number, multiplicity, and depth.Our results are sharp up to a subexponential factor, thus improving Backelin's bounds by an exponential factor for all q ≥ 3 and yielding an alternative proof to Theorem 1.1.We abbreviate the constant c q := ⌊(q + 2) 2 /4⌋ for q ≥ 1.
As a corollary, we obtain sharp asymptotics on the number Fr q (f ) of depth-q numerical semigroups with Frobenius number f , which generalizes Backelin's count of semigroups of depth 2, 3, and 4 to arbitrary depth.We also obtain sharp asymptotics on the number of depth-q numerical semigroups with multiplicity m, which we denote by Mult q (m).
Corollary 1.5.We have Mult q (m) = c m+o(m) q for q ≥ 2. Theorem 1.3 also allows us to determine the asymptotic number of semigroups with maximal embedding dimension, settling a recent conjecture of Singhal [16].Let MED(f ) denote the number of numerical semigroups with maximal embedding dimension and Frobenius number f .Corollary 1.6.We have MED(f ) = 2 f /3+o(f ) .
Our methods to count semigroups of large depth differ from the literature (for example, from those in [17]) in that they are very additive-combinatorial in nature.To bound the number of semigroups of fixed genus, Zhu [19] uses Kunz words and reduces the problem to a graph homomorphism inequality due to Zhao [18].We extensively use and refine these methods to prove bounds in the case of fixed Frobenius number.Many of our results from these methods can be phrased in terms of coloring problems on Schur triples.This furthers the connection between numerical semigroups, graph homomorphisms, and additive combinatorics.
Finally, we strengthen existing results on the distribution of multiplicity and genus with respect to Frobenius number, akin to Zhu's results for the distribution of multiplicity with respect to genus [19, §6].Backelin [2] shows that for a fixed Frobenius number f , almost all semigroups have multiplicity f /2 + o(f ); Singhal [16] shows that almost all semigroups with Frobenius number f have genus 3f /4 + o(f ).We strengthen these results by computing the exact limiting distributions in Theorem 5.1 and Theorem 5.5.These results differ from the first half of the paper in that they arise from an analysis of semigroups of depths 2 and 3 instead of arbitrary depth, though some of the results depend on Theorem 1.3 for q = 3.We also show that Theorem 1.3 implies that almost all depth-q numerical semigroups with Frobenius number f have multiplicity close to f /(q − 1) for arbitrary depth q ≥ 3, though we do not determine the exact limiting distributions in this case.
Outline.In Section 2, we introduce Kunz words and discuss the properties of the constants c q .Section 3 establishes the key enumerative results on numerical semigroups of fixed depth which form the backbone of our paper.We apply these results in Section 4 to count numerical semigroups and semigroups with maximal embedding dimension.In Section 5, we prove some statistics on the distribution of multiplicity and genus.Finally, we discuss possible directions of researchsharpening asymptotics, enumerating other kinds of numerical semigroups, and studying general polychromatic Schur problems-in Section 6.

Kunz words and the constants c q
In this section, we define Kunz words, prove some initial bounds on the number of Kunz words, and discuss some properties of the sequence (c q ) q≥1 .
2.1.Kunz words.Following Zhu [19, §3], we define the Kunz word of a numerical semigroup.Definition 2.1.Let Λ be a numerical semigroup with multiplicity m.The Kunz word All of our examples will have w i a digit from 1 to 9 for clarity, but the entries can be arbitrarily large in the general case.
Note that Λ is generated by {m, m • w 1 + 1, . . ., m • w m−1 + (m − 1)} (known as the Apéry set of Λ), so K is a bijection between numerical semigroups of multiplicity m and Kunz words of length m − 1.
The quantity K(Λ) is more traditionally regarded as a vector of scalars (w 1 , . . ., w m−1 ), known as the Kunz coordinate vector of Λ. Introduced by Kunz in 1987, the Kunz coordinate vector is typically regarded as a point in (m − 1)-dimensional space; authors have used lattice methods, such as Ehrhart theory [10, Thm.9], to count numerical semigroups.Recently, Bacher [1] and Zhu [19] regard K(Λ) as a word whose entries are constrained by the Kunz conditions, then enumerate these combinatorially.We adopt the latter approach for this paper, and hence we opt to speak in terms of Kunz words (as opposed to coordinates) to emphasize our approach within our notation.
We often refer to invariants of a numerical semigroup via its Kunz word; for instance, the genus of the Kunz word 31221 is 9.However, we never refer to the multiplicity of a Kunz word and instead speak of its length, which we denote ℓ := m − 1 for brevity.Definition 2.4.A Kunz word is q-Kunz if its depth (that is, its maximum entry) is at most q.
It is natural to ask which words correspond to valid Kunz words of a numerical semigroup.This question was resolved by Kunz: Proposition 2.5 (Kunz [13, ?]).A word w 1 • • • w ℓ with positive integer entries is a valid Kunz word if: • w i + w j ≥ w i+j for all i, j with i + j ≤ ℓ; and These inequalities are the Kunz conditions.Definition 2.6.For a fixed length ℓ, we say the word w 1 • • • w ℓ is Kunz if its entries satisfy the Kunz conditions.
It will be useful to work exclusively with sets of Kunz words with fixed invariants.Hence, we let K(f, ℓ) denote the set of Kunz words with Frobenius number f and length ℓ.When a parameter is set to N, we let that parameter vary; for instance, K(N, ℓ) denotes the set of Kunz words with length ℓ.In lieu of K, we use K q to denote q-Kunz words instead of general Kunz words.
2.2.Initial bounds on #K q .We prove the following initial bounds on #K q (N, ℓ) and #K q (f, N) which, while much weaker than our main results, helps with some technicalities in Section 4.
We also exactly count Kunz words of small depth, which mirrors Backelin's enumeration of numerical semigroups of small depth.This will later be useful to reprove Theorem 1.1 and to determine distributions on numerical semigroups in Section 5.
Proof.Part (i) is not difficult and is shown in, for instance, [16,Thm. 10], since all words with 1's and 2's are 2-Kunz.For part (ii), a 3-Kunz word . For W to be 3-Kunz, it must satisfy the following conditions: , since otherwise j is not maximal for which w j = 3; and . .w j is itself 3-Kunz and w j = 3.These conditions are also sufficient, so #K 3 (f, ℓ) = 2 ℓ−j • #K 3 (st, j).The result follows.
Remark.It is tempting to directly estimate the size of K 3 (st, j) using the Kunz condition arising from w j = 3. Namely, since w 1 • • • w j ∈ K 3 (st, j) forces w j = 3, we have that w i + w j−1−i ≥ 3 for i = 1, 2, . . ., ⌊(j − 1)/2⌋.Hence, w i and w j−1−i cannot both be 1's, which implies that • #K 3 (st, j) ≤ 8 (j−1)/2 when j is odd, and • #K 3 (st, j) ≤ 2 • 8 (j−2)/2 when j is even.However, these naive bounds are not sharp, since not all words with w i + w j−1−i ≥ 3 are necessarily Kunz.In fact, Theorem 1.3 implies that #K 3 (st, j) = 6 j/2+o(j) , so the naive bounds are an exponential factor away from the truth.Even worse, one can check that the naive bounds give a bound of roughly #K 3 (f, N) ≤ 1 6 f 2 f /2 , which is not even enough to reprove Theorem 1.1.The naiveté is similarly bad for large depth: there are 1 2 (q 2 + 3q − 2) solutions to a + b ≥ q where a, b ∈ [q], so the naive method gives a bound of #K q (st, j) ≤ 1 2 (q 2 + 3q − 2) (j−1)/2 , which is off from the true answer given by Theorem 1.3 by a factor of about 2 j/2 .This is essentially Backelin's bound for q ≥ 5; see [2, eq. 15].Thus, we must be more careful in bounding quantities like #K q (st, j) for q ≥ 3, which is essentially the focus of Section 3.2.
Proof.We wish to show c q+r+1 q > c q+r q+1 , or c q > (c q+1 /c q ) q+r .We have that Hence, c q+1 /c q ≤ q+3 q+1 in all cases.Therefore, . This shows the result for q ≥ 4. The result can be checked manually for q = 2, 3.

Kunz words of fixed depth
In this section, we prove Theorem 1.3, which forms the backbone of our paper by implying a large number of enumerative results, namely Corollaries 1.4, 1.5, and 1.6.Moreover, the case of q = 3 plays an important role in showing the convergence of certain sums in the proofs of Corollary 5.3 and Theorem 5.6.
The central idea is that every instance of q in a q-Kunz words imposes a strong Kunz condition on the other entries.Thus, a cluster of q's imposes a large number of restrictions and limits the number of valid Kunz words, so much so that we can actually disregard the other conditions and still show the necessary upper bound.Then, we will represent each of these restrictions with an edge to form an almost-regular graph on the entries of the word.

Graph lemmas.
To bound the number of q-Kunz words, we bound the number of colorings of certain graphs arising from these Kunz words.In this section, we establish the graph lemmas needed for our proofs.Of great use to us is the following graph homomorphism lemma due to Zhao [18].Definition 3.1.A graph H, possibly with loops, is a threshold graph if there exists a labeling g : V (H) → R and threshold λ such that for (possibly equal) u, v ∈ V (H), we have uv ∈ E(H) if and only if g(u) + g(v) ≥ λ.
The graph H q is the threshold graph with q vertices labeled 1, 2, . . ., q and threshold λ = q.
The hypothesis of Theorem 3.2 requires that G is d-regular, but many of the graphs we work with are "almost regular" in the sense that almost, but not all, vertices have degree d.We perturb these graphs to be d-regular without decreasing the number of graph homomorphisms using the following technical lemma. 2 Strangely, the result is not explicitly written within the paper, but rather follows from a series of implications at the bottom of pg.663 in [18]; Zhao proves that all threshold graphs are GT graphs, that is, they satisfy the given inequality.

Lemma 3.4. Let G be any graph with maximum degree at most d, and abbreviate D := D d (G).
There is a d-regular graph G ′ with the following properties: Proof.Before modifying G, color every vertex in V (G) blue.For a two-colored graph G, say a homomorphism from G to H q is admissible if every red vertex is mapped to the H q -vertex labeled q.Then the following operations do not decrease the number of admissible homomorphisms: • removing an edge between blue vertices; • adding isolated vertices (either red or blue); • adding edges between two vertices, not both blue.
The first operation decreases the number of restrictions on blue vertices, and for the last two operations, we can send every red vertex with the H q -vertex labeled q without adding restrictions to the blue vertices.Hence, we perform the following procedure on G to get a new graph G ′ : (1) If #V (G) is odd, add an isolated, unlabeled blue vertex (so now #V (G) is even).with least degree (breaking ties arbitrarily).( 5) Add an edge between two red vertices of least degree (breaking ties arbitrarily) until all red vertices have degree d.
We claim that every step is valid and that the procedure finally yields a d-regular graph G ′ .
Step (1) causes no issues and increases D by d if we add a new vertex.Step ( 2) is possible since removing an edge increases D by 2, and #V (G) is even so D is even; we remove at most d edges, so D increases by at most 2d.
Step (3) is also fine; we add at most max{D/d, 2⌈d/2⌉} edges at this point.
Step (4) allows all blue vertices to have degree d; since there are at least D/d red vertices, no red vertex will have degree more than d, and since there at least d red vertices, the d − x red vertices we choose are all distinct.Step ( 5) is only done if D/d < d, in which case we have an even number of red vertices whose degrees total to D and pairwise differ by at most 1.Adding an edge maintains the latter property, while increasing the total degree by 2. After adding d⌈d/2⌉ − D/2 edges, the total degree is d • 2⌈d/2⌉ and so every red vertex will have degree d.
Voilà!The end graph G ′ is d-regular and has at most 1 + max{3 + D/d, 2⌈d/2⌉} + #V (G) vertices.It has at least as many admissible homomorphisms as G, the latter of which has exactly hom(G, H q ) admissible homomorphisms.Every admissible homomorphism is a homomorphism, so we have hom(G ′ , H q ) ≥ hom(G, H q ) as desired.
We also use the following estimate on graph homomorphisms in our calculations.
Proof.Suppose some vertex v in K d,d is sent to the H q -vertex with label m, where m is minimal.There are two ways to choose the bipartite half of v, and vertices in this half must be sent to H q -vertices with labels in [m, q].Then the other half must be sent to H q vertices with label at least q − m.Hence, for fixed m, there are at most 2(q − m + 1) d (m + 1) d homomorphisms.So the total number of homomorphisms is at most since (q − m + 1)(m + 1) is at most (q + 2) 2 /4 by the AM-GM inequality and is an integer.

t-tail-heavy words.
In the spirit of using clusters of q's to impose Kunz conditions, we make the following definition: In essence, t-tail-heavy words of depth q are words with a large number of q's amongst the last t entries, restricted by the Kunz conditions arising from these q's.We prove the following estimate on the number of t-tail-heavy words of depth q.
Theorem 3.7.The number of t-tail-heavy words of length ℓ and depth q is at most tq t c ℓ+ √ ℓ+10 q .
Proof.Abbreviate h := ℓ − t, and suppose W = w 1 • • • w ℓ is t-tail-heavy of depth q.There are at most q t ways to choose the last t entries w h+1 , . . ., w ℓ , so it suffices to count the number of ways to choose Construct a graph G with h vertices labeled 1, 2, . . ., h such that xy ∈ E(G) if x+y ∈ {i 1 , . . ., i n }.By the above discussion, the number of choices for W H is at most hom(G, H q ).We cannot directly use Theorem 3.2 since G is not regular, but G has enough vertices of degree n that we will perturb G to make an n-regular graph.Namely, every vertex with labels t+1, . . ., h has degree n other than those with label in {i 1 /2, . . ., i n /2}, which have degree n − 1.Hence, we have that D n (G) ≤ n + nt, so by Lemma 3.4 there is an n-regular graph and hom(G ′ , H q ) ≥ hom(G, H q ).Now, we have that hom(G, H q ) ≤ hom(G ′ , H q ) ≤ hom(K n,n , H q ) (ℓ+5)/(2n) ≤ (2q • c 2n q ) (ℓ+5)/(2n) by Lemma 3.5.Hence, the number of t-tail-heavy words of depth q is at most , as we had sought.
3.3.q-Kunz words.We are almost ready to prove Theorem 1.3.We only need a short lemma about an operation sending q-Kunz words to (q − 1)-Kunz words.
Proof.For any pair (i, j) with i + j ≤ ℓ, consider the quantities If not, then we have (v i , v j ) = (w i , w j ) and it follows that v i + v j = w i + w j ≥ w i+j ≥ v i+j .A similar analysis is true for the case i + j > ℓ + 1. 3 Here, the choice of √ ℓ is not important; we may use any sub-ℓ log ℓ function which goes to infinity as ℓ grows large.
Every word consisting of 1's and 2's is 2-Kunz, so it is not hard to see that for q = 2 the number of numerical semigroups with multiplicity m and Frobenius number f ∈ (m, 2m) is 2 αm+O (1) , where α = (f − m)/m.This will serve as our base case for the induction in our proof; although strictly speaking Theorem 1.3 is not true for q = 2, the only important part of the inductive step is that, asymptotically, there are fewer words of depth q − 1 than depth q.
Proof of Theorem 1.3.We prove the result by induction, with the "base case" of q = 2 (see the above discussion).Throughout, we work directly with Kunz words of length ℓ = m − 1, and we wish to bound the size of #K q (f, ℓ) from below and from above.
Lower bound.Let j = f − m(q − 1) = αm.Consider the family of words w 1 • • • w ℓ governed by the following conditions: we must have w j = q and require that w i is in the interval Recall from Proposition 2.3 that the Frobenius number of the words in this family is equal to (ℓ + 1)(q − 1) + j = f .We claim these words are q-Kunz.Indeed, the Kunz conditions are guaranteed if we have w x + w y ≥ q or w x + w y = q − 1 and x + y > j.The only other case is when x, y > (ℓ + j + 1)/2, in which case x + y − ℓ − 1 > j and so w x + w y + 1 ≥ q − 1 ≥ w x+y−ℓ−1 , as desired.
Upper bound.Select ε > 0 and let t := ⌈εℓ⌉.Split the word for all nonnegative integers k with kt + 1 ≤ ℓ; every chunk has length t, except possibly the final chunk, and there are C + 1 ≤ ⌈1/ε⌉ chunks in total.Say a chunk is heavy if it contains more than √ ℓ entries equal to q.We split into cases depending on whether some chunk is heavy.
Case 1: No heavy chunk.In this case, W is essentially (q − 1)-Kunz, namely it does not have many q's.Formally, each chunk has less than √ ℓ entries equal to q, so if t ≥ 2⌊ √ ℓ⌋ (which is true for ℓ large), then there are at most ways to place the q's in each chunk, for a total of at most √ ℓ(εℓ) ways to place the q's overall.For each placement of q's, we may use the operation in Lemma 3.8 to send W to a (q − 1)-Kunz word.Given the placement of q's, the operation is injective, so for each placement we have at most #K q−1 (N, ℓ) ways to select the remaining entries.The total number of Kunz words in this case is at most √ ℓ(εℓ) Proof sketch when there is at least one heavy chunk (shown jagged).
Case 2: Some heavy chunk.Select the largest k for which W k is heavy, that is, pick the rightmost heavy chunk.Let ℓ k be the length of W k which is t unless (k + 1)t > ℓ.Since W has Frobenius number f , we must have kt + 1 < f − (ℓ + 1)(q − 1) = α(ℓ + 1).
The idea is to apply Theorem 3.7 to the left and right sides of W k ; see Figure 1, where jagged segments indicate heavy chunks and arrows denote applications of the t-tail-heavy result.The bolded jagged region denotes the rightmost heavy chunk.
First, note that, by definition, the word Therefore, by Theorem 3.7 we can select the first ways.As for the later chunks, first fix the placement of q's amongst the last C − k chunks and then use the operation from Lemma 3.8 on each chunk W k , W k+1 , . . ., W C to obtain new chunks V k , V k+1 , . . ., V C ; this map is injective given the placement of the q's.Let rev(W ) denote the reverse of the word W . Then note that the word Hence, if we fix the placement of q's amongst the last b k := ℓ − a k entries, there are at most ways to designate V * , which in turn designates the other entries.Since the chunks to the right of W k are not heavy, there are at most √ ℓ(εℓ) placements of q's in the last b k entries.Thus, there are at most √ ℓ(εℓ) ways to choose the last b k entries.The total number of Kunz words in this case is at most Therefore, the quantity K q (N, ℓ) is bounded above by the sum of the bounds from our two cases.
We now determine the asymptotics of our upper bound.The term √ ℓ(εℓ) q .By the inductive hypothesis, #K q−1 (N, ℓ) is asymptotically less than c ℓ q , so the total from the first case is overall subexponential.In the second case, we have c q > c q−1 so the leading asymptotic term of the sum is when a k is maximal, in which case we have a k = αℓ+o(ℓ), which implies b k = (1 − α)ℓ + o(ℓ).Moreover, we have ℓ k ≤ t.Hence, we can summarize the total bound in both cases as where the first summand is the bound from Case 1 and the second summand is the bound from Case 2. This is a bound of #K(N, ℓ) ≤ q 2t c αℓ+o(ℓ) q c (1−α)ℓ+o(ℓ) q−1 .Letting ε go to 0 gives the desired bound.
Figure 2 depicts the relationship between the ratio f /m = q + 1 − α and the growth rate (#K q (f, ℓ)) 1/m as m grows large.The curve is exponential piecewise, and the growth rate approaches f /(2m) + 1 as f /m grows large.The growth rate for all f /m > 2 is new.
exist and are constants.
The proof uses the estimate that there are at most 3 • 2 f /2 numerical semigroups with m ≥ f /4, namely with depth at most 4. In this section, we obtain an estimate akin to Backelin's result for numerical semigroups of any depth by proving Corollary 1.4, which coupled with Proposition 2.10 implies a strengthening of Theorem 1.1.
Proof of Corollary 1.4.The result holds for q = 2 and q = 3 by Proposition 2.10, so assume q ≥ 4.
Formally, if we let ℓ := m − 1 we have , by Corollary 2.12, which shows the upper bound.We also have , which shows the lower bound.We have , so as f grows large, β tends to 0. Hence, #K q (f, N) = (c q−1 ) f /(q−1)+o(f ) , as desired.
From this result, we can prove that almost all numerical semigroups with Frobenius number f are depth 2 or 3.This was first observed by Singhal Proof.Evidently Fr 1 (f ) = 1 and f ≥ q.We cannot directly sum the bound in Corollary 1.4 over all q ∈ [2, f ] since the o(f ) term in the exponent is non-uniform as q varies.However, we can use the uniform bound in Corollary 2.9: By Lemma 2.11 with r = 1, the first summand has asymptotically leading terms at q = 2 and q = 3, which are 2 f /2+o(f ) .These terms also clearly dominate the second summand for large f , which yields the result.Proposition 2.10 and Corollary 4.2 collectively imply Theorem 1.1.
Proof of Theorem 1.1.By Corollary 4.2, almost all numerical semigroups have depth 2 or 3.There are 2 f /2+O(1) numerical semigroups with these depths by Proposition 2.10, as desired.To show the constant term depends on the parity, see Corollary 4.3.
In fact, by summing over all possible ℓ, we can write down the exact values of C 0 and C 1 in terms of infinite sums, lifting a result of Backelin [2, eq. 30] to the language of Kunz words.Corollary 4.3.We have that Proof.We simply divide the counts derived in Proposition 2.10 by the total from Theorem 1.1.
Moreover, Theorem 1.3 implies Corollary 1.5, which determines sharp asymptotics on the number Mult q (m) of depth-q numerical semigroups with multiplicity m.

MED semigroups.
A numerical semigroup Λ has maximal embedding dimension (abbreviated MED) if its Apéry set minimally generates Λ.In this case, we say Λ is an MED semigroup.In terms of Kunz words, the Kunz word Let MED(f ) denote the number of MED semigroups with Frobenius number f , and MED q (f ) the number of semigroups with Frobenius number f and depth q.In 2022, Singhal [16] proved that there are constants c and c ′ such that and conjectured that lim f →∞ log 2 (MED(f ))/f exists.He also notes that numerical data suggests that the limit may be around 0.375.We prove this conjecture by showing this limit to be exactly 1/3 in Corollary 1.6, which turns out to be significantly smaller than the value suggested by numerical calculations for small values of f .Given an MED Kunz word also satisfies the Kunz conditions.It follows quickly that there is a bijection between MED semigroups of multiplicity m and numerical semigroups containing m (or their corresponding Kunz words); we mark down the latter condition by using the notation Fr {m} and K {m} in lieu of Fr and K.As a result, we have the following sum.Lemma 4.4 ([16,Cor. 3]).We have that Note that the numerical semigroups counted on the right-hand side have depth q ′ , which is at most ⌈(f + 1 − m)/m⌉ = q − 1, since the multiplicity of these semigroups is at most m.Unfortunately, the notation in this section is a bit confusing since we juggle MED semigroups and words in K {m} (f − m).We will consistently refer to the multiplicity of the MED semigroup by m and the multiplicity of the corresponding depth-q ′ word by m ′ = ℓ + 1, where ℓ is the length of the word.We try to remind the reader of this when possible.
We bound the number of MED semigroups for all depths q and show that almost all MED semigroups are depth 3 or 4. To do this, we use Lemma 4.4, which allows us to apply our bounds for general numerical semigroups to MED numerical semigroups, lifting Theorem 1.3 to Corollary 1.6.This is most important in Lemma 4.7, where we estimate the number of MED semigroups with depth at least 4. The case of q = 1 is vacuous, so we first consider q = 2. Remark.It happens that MED 2 (f ) is the sequence A103580 in the OEIS with each entry repeated twice; the OEIS sequence counts how many nonempty subsets of {1, . . ., n} contain all its pairwise sums that are at most n, which is exactly the number of nontrivial semigroups with Frobenius number at most n.Hence, A103580(n) = 2 n/2+O (1) , which is (as far as we know) a new result that answers a question of Kitaev on well-based sets on path-schemes [12].
Proof.We show the lower and upper bounds separately.
Lemma 4.7.For q ≥ 4, we have that the last equality by Corollary 1.4.We have the inequality .
Hence, the second summand can be bounded: is maximized at q ′ = q by Lemma 2.11 with r = 0.The lemma also implies that , so it suffices to show the upper bound on the first summand only.Letting α = (f −m)/m ′ −(q−2), we write the following equalities, the second given by Theorem 1.3: . Lemma 2.11 for r = 0 tells us that for fixed m, the summand is maximized when m ′ = m, at which point the summand is equal to .
If we let m = (f + 1)/(q − 1 + r), then Corollary 2.12 tells us that the summand is maximized at r = 0, at which point the summand is c . This is enough to show the upper bound.
We now derive Corollary 1.6.
Proof of Corollary 1.6.Proposition 4.6 gives the lower bound.As for the upper bound, we cannot sum over all q by the same analytic issue as the previous section, so Corollary 2.9 will be of use to us.Namely, we can write where the last line is given by Proposition 4.5, Proposition 4.6, and Lemma 4.7.By Lemma 2.11 for r = 1, the leading terms are at q = 3 and q = 4, which are 2 f /3+o(f ) .These terms also clearly dominate the second summand for large f , which yields the result.
It should be possible to write down an analogue of Proposition 2.10 for MED semigroups of depth 3 and 4, which would improve the bound to 2 f /3+O (1) and yield a result analogous to Corollary 4.3 but with constant factor depending on f (mod 6).However, we do not execute this here.

Distributions on numerical semigroups
In this section, we discuss the distribution of multiplicity and genus over numerical semigroups with fixed Frobenius number.

Distribution of multiplicity.
To begin, it turns out that our analysis in Proposition 2.10 immediately implies the following distribution result.
Theorem 5.1.Let Λ f be a random numerical semigroup with Frobenius number f (under the uniform distribution).Then for any integer k, we have that: This is similar to a result of Zhu [19, Thm.6.1], which determines the limiting distribution of f − 2m for numerical semigroups of fixed genus.Figures 3 and 4 depict the limiting distributions for even and odd f , respectively.
Proof.By Corollary 4.2, we only have to consider semigroups of depth 2 and 3. Now, we may use Proposition 2.10 and the fact that there are (C i +o(1))2 f /2 numerical semigroups with Frobenius number f to prove the result, where f ≡ i (mod 2).This is a strengthening of the following result of Backelin, which shows that asymptotically, almost all semigroups have multiplicity close to f /2: f − 2m Proposition 5.2 (Backelin [2]).For any ε > 0, there exists an integer N such that for every positive integer f , there are less than ε • 2 f /2 semigroups with Frobenius number f and multiplicity outside of As a corollary, we can show the following result on the average multiplicity of a numerical semigroup with Frobenius number f .This in part relies on the fact that #K 3 (st, 2k) is exponentially less than 8 k by Theorem 1.3.
Corollary 5.3.Let Λ f be a random numerical semigroup with Frobenius number f .Then there are constants µ 0 and µ 1 such that as f grows large, the average value of m(Λ f ) − f /2 approaches µ 0 for f even and µ 1 for f odd.
Proof.We show the result for f even; the odd case is analogous.By Theorem 5.1, as f grows large, the average multiplicity tends to k<0 The right summand consists of the sum of two series.The first is a arithmetico-geometric series with ratio 1/2, while the second converges since Corollary 1.5 implies #K(st, 2k) = 6 k+o(k) .Hence, the right summand converges to some constant µ 0 , as desired.
While we cannot prove a fine distribution result for semigroups of arbitrary depth, we can still show almost all depth-q numerical semigroups with Frobenius number f have multiplicity close to f /(q − 1).Theorem 5.4.For q ≥ 3, let Λ f,q be a random depth-q numerical semigroup with Frobenius number f (under the uniform distribution).Then, for any ε > 0, we have Proof.We will show the proportion of numerical semigroups with f − (q − 1)m ≥ εf approaches 0. Recall from Theorem 1.3 that the number of numerical semigroups with Frobenius number f and multiplicity m is , where α = f /m − (q − 1) ≥ ε.By Corollary 2.12, this quantity is asymptotically maximal when α = ε.Hence, the proportion of numerical semigroups with f − (q − 1)m ≥ εf is .
The total number of depth-q numerical semigroups with Frobenius number f is (c q−1 ) f /(q−1)+o(f ) by Theorem 1.3, which dominates the right-hand side as f grows large.So the proportion we sought is indeed 0.
5.2.Distribution of genus.Our results on multiplicity can be used to deduce results on the genus of numerical semigroups with fixed Frobenius number.We first show the following distribution result on the genus of a numerical semigroup with fixed Frobenius number.The limiting distribution is binomial in the following sense.
Theorem 5.5.Let Λ f be a random numerical semigroup of Frobenius number f .Then as f grows large, the distribution of is the standard normal distribution.
This strengthens a result of Singhal, who describes the limiting distribution of genus with respect to Frobenius number in terms of a normal distribution and an infinite sum [16,Thm. 14].
Proof.By Corollary 4.2, we only have to consider depth-2 and depth-3 semigroups, which were characterized in Proposition 2.10 and Theorem 5.1.In particular, almost all numerical semigroups of depth 2 are of the form For this family of words, since the last o( √ f ) entries equal to 1 are asymptotically negligible, we have which is the standard normal distribution by the Central Limit Theorem.Similarly, almost all 3-Kunz words are of the form For this family of words, the first f − 2m − 1 = o( √ f ) entries are also asymptotically negligible, in the sense that we also have The distribution of this quantity also is standard normal, as desired.
Moreover, Singhal [16,Thm. 1.2] shows the average genus of numerical semigroups with Frobenius number f is 3f 4 + o(f ).We strengthen this to an O(1)-level estimate, similarly to Corollary 5.3.Theorem 5.6.Let Λ f be a random numerical semigroup with Frobenius number f .Then there are constants γ 0 and γ 1 such that as f grows large, the average value of g(Λ f ) − 3f 4 approaches γ 0 for f even and γ 1 for f odd.
Proof.We show the result for f even; the odd case is similar.By Corollary 4.2, we only have to consider depth-2 and depth-3 semigroups, which were characterized in Proposition 2.10 and Theorem 5.1.
First, we consider the numerical semigroups with depth 2, which have Kunz words of the form and m > f /2.This family of words has an average genus of (f − m − 1) . By Theorem 5.1, the proportion of numerical semigroups with Frobenius number f that have multiplicity m = f /2 − k is C −1 0 2 k−1 for k < 0. Thus, as f grows large, the depth-2 contribution to the overall average genus approaches Similarly, depth-3 semigroups have Kunz words of the form w 1 . . .w m−1 , where: W ∈K 3 (st,j) g(W ) denote the average genus of the Kunz words in K 3 (st, j).Then for fixed f and m, the average genus of a numerical semigroup with Frobenius number f and multiplicity m is ) of all semigroups with Frobenius number f , so the depth-3 contribution to the overall average genus approaches Hence, the overall average genus is k<0 It suffices to show that the right summand in parentheses converges to some constant γ 0 .The first summation clearly converges, and the second summation also converges since G j ≤ 3j, and #K 3 (st; 2k) = 6 k+o(k) by Theorem 1.3 for q = 3.Hence, we have the desired result.

Future directions
In this section, we discuss our results and some possible directions of future study.
6.1.Subexponential factor.In this paper, we prove many results that pin down the exponential growth factor but do not estimate the subexponential factor.Our bounds are of the form C n+o(n) , so it would be nice to sharpen these to a polynomial factor p(n)C n or even a constant factor A • C n .For instance, Theorem 1.3 implies that #K 3 (st, ℓ) = 6 ℓ/2+o(ℓ) , but we write down rough ℓ O( √ ℓ)level upper bounds on the 6 o(ℓ) factor while our construction only gives 6 ℓ/2+O(1) Kunz words.Reconciling these bounds would yield a better understanding of the structure of 3-Kunz words.Table 1 lists #K 3 (st, ℓ) for ℓ ≤ 56 due to Zhu [19, §7.1], while Figure 5 graphs the quantity 6 −ℓ/2 • #K 3 (st, ℓ).It is unclear whether we should expect the subexponential factor to be constant, linear, or another function altogether.
Since #K 3 (N, ℓ) = ℓ j=0 2 ℓ−j #K 3 (st, j), better bounds on #K 3 (st, ℓ) automatically give better bounds on #K 3 (N, ℓ).Sharpening these bounds could help resolve a question of Kaplan [11], who asks whether lim k→∞ Fr(2k)/ Fr(2k − 1) = √ 2 • C 0 /C 1 is greater than, less than, or equal to 1. Backelin [2, eq. 13] proves the weaker but computationally useful bound Corollary 4.3 expresses C i as an infinite sum.We can take partial sums using , so we surmise that Kaplan's limit is less than 1.Of course, the larger question of finding the subexponential factor of #K q (N, ℓ) or Fr q (f ) for general q is also open.Results of this form could strengthen the asymptotics of Theorem 1.1 to lower-order terms, and could sharpen Theorem 5.4 to an O(1)-level distribution like Theorem 5.1.To get a sense of the magnitude of the subexponential factor in the general case, we have included the values of #K(f, m − 1) for small values of f and m in Table 2, and we have graphed the values of (#K(f, m − 1)) 1/m against f /m for these values in Figure 6.The values for m = 8, 10, 12 were acquired with the numericalsgps GAP package, while the values for m = 15 were calculated with a program similar to Zhu's program to compute #K 3 (st, ℓ) [19, §7.1].

6.2.
Other statistics.There are many classes of numerical semigroups other than MED semigroups that remain to be counted.Backelin shows that the number of irreducible semigroups, or semigroups that are not the intersection of two other semigroups, with Frobenius number f is 2 f /6+O (1) .These have a relatively natural description in terms of Kunz words, so our methods may adapt to questions of this type.There are similar parametrizations in terms of Kunz words for Arf [9] and atomic [14] numerical semigroups, which could also be counted.We also do not compute the subexponential term for the number of MED numerical semigroups; we expect that, for fixed q, one could obtain sharper bounds for MED q (f ) akin to Corollary 1.4 and Proposition 2.10.
We do not thoroughly study the genus of numerical semigroups in this paper.Zhu [19] shows the number of semigroups with genus g and depth at least 4 has exponential growth rate between 1.51 and 1.55 and conjectures the true growth rate to be the unique positive zero of x 6 −x 3 −2x 2 −2x−1 with value near 1.51519.Our methods work well for tail-heavy words, but there seem to be fundamental obstructions to our estimates when a q-Kunz word has its rightmost heavy chunk near the middle of the word or has no heavy chunks at all.Results in this direction could shed light on the remaining size conjectures of Bras-Amorós [6]; for more info, see the final section of [19].6.3.Polychromatic Schur problems.In this paper, we bound the size of K 3 (N, ℓ), which is the set of words w 1 • • • w ℓ such that there are no i, j with w i = w j = 1 and w i+j = 3.We can rephrase this suggestively as an additive combinatorics question about colorings.
Question.How many ways can {1, 2, . . ., n} be colored red, green, and blue so that a red number plus a red number is never a blue number?
Recall that x, y, z ∈ [n] (not necessarily distinct) form a Schur triple if x+y = z.Then the above question is equivalent to avoiding a Schur triple with x, y red and z blue.Corollary 1.5 for q = 3 implies there are 6 n/2+o(n) such colorings.Many questions can be rephrased in terms of colorings and Schur triples: • With two colors, black and white, sum-free sets are equivalent to black + black = black and numerical semigroups are equivalent to black + black = white.• With k colors and sufficiently large n, we cannot color [n] to avoid color + color = color for every color by Schur's theorem.• With three colors, avoiding + blue = green and permutations is equivalent to avoiding rainbow Schur triples [7].The typical language of independent sets and hypergraph containers [3] has interesting applications in the polychromatic case via the language of color templates in [7].We study the above question in its own right via the lens of graph homomorphisms and hypergraph containers in future work.
Appendix A. Sample data on #K q (f, ℓ)

Lemma 2 . 11 .
For any r ∈ [0, 1], the sequence (c 1/(q+r) q The quantity D d (G) can be viewed as the "discrepancy" v∈V (G) (d − deg v) between G and an d-regular graph.

( 2 )
Remove edges between blue vertices until D := D d (G) is divisible by d. (3) If D/d > d, add D/d isolated red vertices.Otherwise, add 2⌈d/2⌉ red vertices.(4) For each blue vertex v b with degree x < d, draw d − x edges from v b to the d − x red vertices
Table 1 to get a lower bound on C i , and also use Backelin's bound to get an upper bound on C i .This method gives 1.2606 < C 0 < 1.3919, 1.2755 < C 1 / √ 2 < 1.4068, which are a modest improvement to Backelin's original bounds 4 [2, §I.3].The numerics of the partial sums suggest that C