Union of sets of lengths of numerical semigroups

Let $S=\langle a_1,\ldots,a_p\rangle$ be a numerical semigroup, $s\in S$ and ${\sf z}(s)$ its set of factorizations. The set of length is denoted by ${\mathcal L}(s)=\{{\tt L}(x_1,\dots,x_p)\mid (x_1,\dots,x_p)\in{\sf Z}(s)\}$ where ${\tt L}(x_1,\dots,x_p)=x_1+\ldots+x_p$. From these definitions, the following sets can be defined ${\textsf W}(n)=\{s\in S\mid \exists x\in{\sf z}(s) \textrm{ such that } {\tt{L}}(x)=n\}$, $\nu(n)=\cup_{s\in {\textsf W}(n)} {\mathcal L}(s)=\{l_1<l_2<\ldots<l_r\}$ and $\Delta\nu(n)=\{l_2-l_1,\ldots,l_r-l_{r-1}\}$. In this paper, we prove that the set $\Delta\nu(S)=\cup_{n\in{\mathbb{N}}}\Delta\nu(n)$ is almost periodic with period ${\rm lcm}(a_1,a_p)$.


Introduction
In many rings and semigroups, their elements can be written as a finite product (or sum) of other elements, but in general the factorizations are not unique, which is not what happens in the ring of integer numbers. The non-unique factorization theory describes and classifies these aspects using the invariants of the algebraic structure we are working with (see [1] for further background). From among these parameters we can highlight the ω-primality, the tame-degree, the ∆-set and the elasticity. What they try to measure, in a way or another, is how far is a semigroup or a ring from having unique factorizations, and if they are not unique they explain its behaviour. For example, if the ∆-set of an element is the empty set, that means that the length of all its factorizations are the same. The computation of these parameters is always after a deep theoretical study because, in general, even if its definitions are not complicated, the computation for values not necessarily very high is not trivial and it requires knowing some of its properties (bounds, periodicity, etc.) to be able to obtain effective algorithms for getting examples.
In recent years, a type of structure where these parameters have been well studied are the numerical and affine semigroups. We highlight, for example, the library "NumericalSgps" made in gap [2] where there are implemented functions to compute some of these parameters. Following this line, we can emphasize, the following works [3], [4], [5] and many of the references therein.
In this work, we start from the definition of ∆-set of the elements of a numerical semigroup and we define ∆ of the union of a set of elements. Some papers where this parameter appears are the following: in [6] generalized sets of lengths are studied in Dedekind domains by Chapman and Smith and in [7] its asymptotic behaviour is shown, in [8] some properties of the set ν n are obtained for numerical semigroups generated by an arithmetic progressions, in [9] the set ∆ν(M ) is computed for several monoids and the asymptotic behaviour of ∆ν n is also studied. This invariant has also been analyzed by Chapman, Freeze and Smith in [10]. More recently, Geroldinger in [11] made a survey for some parameters and proved using that d = min(∆(S)) = gcd{a i+1 − a i | i = 1, . . . , p − 1}, some results on the structure of ν n . These sets are almost arithmetical progressions, and therefore ∆ν(S) ⊂ {d, 2d, 3d, . . . }.
The main goal of this work is to give properties of the set of length of a numerical semigroup and to obtain algorithms who allow us to compute the function ∆ν. We prove that for its computation we do not need to calculate the ∆-set of all the elements involved and therefore we improve its computation in a remarkable way. We also show that this function is almost periodic and we use this period and its bound for obtaining the function ∆ν for any numerical semigroup. We provide some examples which illustate these algorithms. The software developed and all its examples can be downloaded in [12].
In Section 1 we give some basic definitions and introduce the notation that we use through this paper. Section 2 is devoted to explain the behaviour of the function ∆ν and an improved algorithm for computing it is also given. Finally, in Section 3 we study the periodicity of ∆ν and some examples are provided.

Definitions and notations
Denote by N the set on nonnegative integers. In this work S denotes a primitive numerical monoid (or numerica semigroup). Since every numerical monoid is finitely generated, there exist a 1 , . . . , a p ∈ N such that S = a 1 < · · · < a p = { p i=1 λ i a i | λ 1 , . . . , λ p ∈ N}. If M is the subgroup of Z p defined by the equation a 1 x 1 +· · ·+a p x p = 0 and ∼ M is the equivalent relation on N p defined by z ∼ M z if z − z ∈ M , then the semigroup S is isomorphic to the quotient N p / ∼ M .
Let s be an element of S.
x i a i = s, then we say that (x 1 , . . . , x p ) is a factorization of s. We denote by Z(s) the set {(x 1 , . . . , x p ) ∈ N p | a 1 x 1 +· · ·+a p x p = s} and we call it the set of factorizations of s.
Define the linear function L : The following definition is found in [3,13].
which is known as the set of lengths of s in S. Since S is a numerical monoid, it is not hard to prove that this set of lengths is bounded, and so there exist some positive integers l 1 < · · · < l k such that L(s) = {l 1 , . . . , l k }.
The set is known as the Delta set of s.
The set is called the Delta set of S.
In [3], it was proved that the function ∆ : S → N is almost periodic. The following definition is found in [8,9,11,14].
Clearly, for every n ∈ N the set ∆ν(n) is a subset of N. Thus, for a S numerical semigroup we define ∆ν as follows: The main aim of this work is to prove that the above function is an almost periodic function and that its period is a divisor of lcm(a 1 , a p ).
An unrefined method for computing ∆ν(n) is the following: Algorithm 1 Sketch of the algorithm to compute ∆ν(n).
INPUT: S = a 1 , . . . , a p a numerical semigroup and n ∈ N.
Example 3. Let S = 5, 9, 11 and n = 41. The cardinality of W(41) is 123 and for the computation of ∆ν(41) using Algorithm 1 it is necessary to know the factorizations of all of them. In the following section, we prove that for any n ∈ N it is only necessary to calculate the factorizations of 111 for computing ∆ν(n).
This number increase with n. For instance, if n = 50 and S = 11, 13, 19 , this number is 255, but Algorithm 2 only need the computation of the factorizations of 111 elements.

Computation of ∆ν(n)
In [3], it is proved that there exists δ ∈ N and a bound N S ∈ N such that δ|lcm(a 1 , a p ) and for every s ∈ S with s ≥ N S we have ∆(s + δ) = ∆(s).
It is straightforward to prove that min W(n) = na 1 y max W(n) = na p . We use the notation of [3] and the elements N S , w, w are defined as there. We recall that explicitly these values are: Lemma 4. Let S be a numerical semigroup and let N S the bound of [3]. There exists N S ∈ N such that for every n ≥ N S we have min W(n) ≥ N S .
Proof. The minimum of W(n) is equal to na 1 . It is enough to take N S ≥ N S a1 . Definition 5. . Let C i be the following values: Define λ 1 = max(C 1 , C 4 ) and λ 2 = − min(C 2 , C 3 ).
Proof. Let n ≥ N 0 , by Lemma 4 we obtain that x ≥ N S for all x ∈ W(n).
Using the properties of the sets Z i (Definition 5), for every x ∈ W(n) with The following system of inequalities is obtained: x a p + L( w ) < n + L( w), x a 1 + L( w) > n + L( w ).
These inequalities are summarized as follows: If (1)  To finish the proof, we now prove the existence of solutions of (5). Note that there exists n such that na p −λ 2 > na 1 +λ 1 and (na p −λ 2 )−(na 1 +λ 1 ) > a p −a 1 . In this way there exists k ∈ N with k ≤ n such that na 1 +λ 1 < na 1 +k(a p −a 1 ) < na p − λ 2 and the element na 1 + k(a p − a 1 ) belongs to W(n). This is fulfilled if (na p − λ 2 ) − (na 1 + λ 1 ) > a p − a 1 which is satisfied if and only if n > a p − a 1 + λ 1 + λ 2 a p − a 1 .
Thus, we assert that there exists x ∈ W(n) satisfying (5).
With the notation of the above proposition, we give the following definitions.
The good part of this algorithm is that even if we increase the value of n, we only have to compute the same number of elements. For instance for n = 150, W (150) ⊂ [600, 2250], but since λ 1 and λ 2 do not depend on n, we save 688 evaluations.
3 Periodicity of ∆ν : N → P(N) The main result of this work is presented in this section. This result allows us to give some example where we compute the function ∆ν for some numerical semigroups.
If there is an elements ∈ W(n + µa p ) withz ∈ Z(s) such that L(z 2 ) < L(z) < L(z 3 ), when we consider the elements − µa p we obtain that such element has a factorization z which verifies L(z 2 ) < L(z) < L(z 3 ) and this is a contradiction. So we have prove that ∆B 3 (n) ⊂ ∆B 3 (n + µa p ). In the same way, the other inclusion can be proven so ∆B 3 (n) = ∆B 3 (n + µa p ).
For i = 1, the demonstration is analogous.
Theorem 11. Let S be a numerical semigroup. The function ∆ν : N → P(N) is almost periodic with period δ = lcm(a 1 , a p ). A bound from which this function is periodic is N 0 .
Proof. From Proposition 10, ∆B 2 (n) = {d}. On the other hand, B 1 and B 3 are periodics with period a 3 and a 1 , respectively, so ∆B 1 and ∆B 3 has the same period. Now we use that ∆ν(n) = ∆B 1 (n) ∪ ∆B 2 (n) ∪ ∆B 3 (n) in order to obtain ∆ν has period lcm(a 1 , a p ).
Finally we illustrate the results of this work with some examples. In these examples we show how we can compute ∆ν(n) for several semigroups for all values of n. In order to get them, we have used a supercomputer [15] checking the tree of numerical semigroups, in a parallel way, ordering the numerical semigroups by its genus and examining them. We discard the semigroups such that they are of the form m, m + k, . . . , m + qk with k, q ∈ N since they are studied in [8].
Example 12. Here we have a collection of numerical semigroups with nonconstant ∆ν.
• It i quite easy to find semigroups such that its ∆ν has constant periodic part. For example, let S be the semigroup 3, 10, 11 , we have that N 0 = 82, and δ = 33. Therefore we only have to compute the first 115 values of ∆ν in order to know all its values. After making this computations, we have the following results: ∆ν(1) = ∅, ∆ν (2)  Thanks to our software (available in [12]) its no difficult to obtain semigroups with non-constant ∆ν and even with non-constant periodic part. This software has been developed in C++ for obtaining the maximum speed. However, in order to provide a friendly interface, we made an interface for Python3 and IPython3 (see [16]) notebooks using swing (see [17]). Therefore, the user can load our library in a Jupyter notebook and use its Python functions which actually calls to our pre-compiled functions in C++, mixing the efficiency of C++ with the user-friendly Python.