1 Introduction

Let us recall that an integer partition (or simply a partition) of a positive integer b is a way of writing b as a sum of positive integers. If two sums differ only in the order of their summands, then they are considered the same partition. For example, the seven partitions of 5 are 5, \(4+1\), \(3+2\), \(3+1+1\), \(2+2+1\), \(2+1+1+1\), and \(1+1+1+1+1\).

The beginnings of partition theory can be dated back to 1676, when G. W. Leibniz asked J. Bernouilli how many partitions are associated to a positive integer (see [2]). In the middle of the 18th century, the same question was posed by P. Naudé to L. Euler, who gave the first results relevant to this question with the help of so-called generating functions. Since then, many works have studied several topics related to partitions (see [1]).

In most cases, those works study the number of possible partitions. However, our purpose is different. More specifically, we will generalise an earlier work by the second author. For a non-empty finite subset B of \(\mathbb {N} \setminus \{0\}\) (where \(\mathbb {N}=\{0,1,2,\ldots \}\) is the set of non-negative integers), in [10] an algorithm is given to compute all sets \(C \subseteq \mathbb {N} {\setminus } \{0\}\) which are minimal (with respect to the inclusion order) in the family of sets that satisfy the following condition: if \(x_1+\cdots +x_n\) is a partition of an element in B, then at least one summand of this partition belongs to C. Let us observe that, in a sense, the elements of the partitions are quasi-required because at least one of these elements belongs to a prefixed set.

Now, we add a second condition over the partition in order to, in a sense, exclude some elements. As usual, \(\langle A \rangle \) is the monoid generated by A (see Sect. 2, third paragraph).

Problem 1.1

If A is a non-empty subset of \(\mathbb {N}\) and B is a non-empty finite subset of \(\mathbb {N} \setminus \{0\}\), then compute all subsets \(C\subseteq \mathbb {N}\setminus \{0\}\) that are minimal (with respect to the inclusion order) in the family of sets \(K\subseteq \mathbb {N}\setminus \{0\}\) that satisfy the following properties:

  1. (i)

    \(K\cap \langle A \rangle =\emptyset \).

  2. (ii)

    If \(x_1+\cdots +x_n\) is a partition of an element of B, then at least one of the summands of the partition belongs to K.

To achieve our aim, we use the theory of numerical semigroups. In particular, we consider the family of irreducible numerical semigroups and the concept of Apéry set of a numerical semigroup. In Sect. 2 we recall some preliminaries on numerical semigroups and, moreover, we relate Problem 1.1 to a question on numerical semigroups.

Let \(\mathscr {S}\) be the set of all numerical semigroups. If A is a non-empty subset of \(\mathbb {N}\), \(F\in \mathbb {N}\setminus \{0\}\), and \(\hbox {F}(S)\) is the Frobenius number of a numerical semigroup S (see Sect. 2, first paragraph), then we use the notation

$$\begin{aligned} \mathscr {S}(A,F) = \{ S\in \mathscr {S} \mid A\subseteq S \text{ and } {\text {F}}(S)=F \} \end{aligned}$$

and

$$\begin{aligned} \mathscr {I}(A,F) = \{ S\in \mathscr {S}(A,F) \mid S \text{ is } \text{ irreducible } \}. \end{aligned}$$

In Sect. 3, we show that \(\mathscr {I}(A,F)\not =\emptyset \) if and only if \(\mathscr {S}(A,F)\not =\emptyset \) if and only if \(F\notin \langle A \rangle \).

In [6] there is an algorithmic process described, implemented in the function IrreducibleNumericalSemigroupWithFrobeniusNumber(\(\cdot \)) of [7], which computes all the irreducible numerical semigroups with a given Frobenius number.

Let us observe that we can compute all the elements of \(\mathscr {I}(A,F)\) quite simply: by using IrreducibleNumericalSemigroupWithFrobeniusNumber(F) we obtain all the irreducible numerical semigroups with Frobenius number equal to F and, after that, we remove those that do not contain the set A.

The main purpose of Sect. 3 is to show an algorithm for computing \(\mathscr {I}(A,F)\) (see Algorithm 3.13) that improves the one described in the previous paragraph.

As a first application of Algorithm 3.13, in Sect. 4, we show another algorithm for computing \(\mathscr {S}(A,F)\) (see Algorithm 4.5 and Remark 4.6). Such an algorithm is a generalisation of the one shown in [5] for computing all the numerical semigroups with a given Frobenius number.

Let us observe that Sect. 4 can be considered a by-product result and, in a first reading, it can be omitted without losing the thread.

If A is a non-empty subset of \(\mathbb {N}\) and B is a non-empty finite subset of \(\mathbb {N} \setminus \{0\}\), then we use the notation

$$\begin{aligned} \mathscr {S}(A,B) = \{ S \in \mathscr {S} \mid A\subseteq S \text{ and } S\cap B=\emptyset \}. \end{aligned}$$

We begin Sect. 5 by showing that \(\mathscr {S}(A,B)\not =\emptyset \) if and only if \(B\cap \langle A \rangle =\emptyset \). With the notation

$$\begin{aligned} \mathscr {M}(A,B) = \hbox {Maximal} \big (\mathscr {S}(A,B)\big ), \end{aligned}$$

in Sect. 5 we use the results of Sect. 3 in order to show an algorithm for computing \(\mathscr {M}(A,B)\) (see Algorithm 5.9). Such an algorithm is a generalisation of the one shown in [10] for computing the maximal elements of the set \(\{ S \in \mathscr {S} \mid S \cap B = \emptyset \}\).

Finally, in Sect. 6 we show an algorithm as an answer to Problem 1.1 (see Algorithm 6.1). As one might expect, the algorithm described is a generalisation of the one shown in [10].

2 Preliminaries

A submonoid of \((\mathbb {N},+)\) is a subset \(M\subseteq \mathbb {N}\) that is closed under addition and contains the zero element. A numerical semigroup is a submonoid S of \(\mathbb {N}\) such that \(\mathbb {N} \setminus S\) is finite. The finiteness of \(\mathbb {N} \setminus S\) allows us to define two relevant invariants of S. Namely, the greatest integer that does not belong to S, called the Frobenius number of S and denoted by \(\hbox {F}(S)\), and the cardinality of \(\mathbb {N} {\setminus } S\), called the genus of S and denoted by \(\hbox {g}(S)\).

Following the notation of [9], a numerical semigroup is irreducible if it can not be expressed as the intersection of two numerical semigroups containing it strictly. In [9] it is shown that a numerical semigroup S is irreducible if and only if it is maximal (with respect the inclusion order) in the set of all numerical semigroups with Frobenius number equal to \(\hbox {F}(S)\). Moreover, from [4] and [8], we can state that the set of all irreducible numerical semigroups is the union of two interesting families of numerical semigroups: the symmetric and the pseudo-symmetric ones.

If X is a non-empty subset of \(\mathbb {N}\), then we denote by \(\langle X \rangle \) the submonoid of \((\mathbb {N},+)\) generated by X, that is,

$$\begin{aligned} \langle X \rangle{} & {} =\big \{\lambda _1x_1+\cdots +\lambda _nx_n \mid n\in \mathbb {N}\setminus \{0\}, \ \{x_1,\ldots ,x_n\}\subseteq X, \\{} & {} \qquad \{\lambda _1,\ldots ,\lambda _n\}\subseteq \mathbb {N}\big \}. \end{aligned}$$

It is well known (see Lemma 2.1 of [11]) that \(\langle X \rangle \) is a numerical semigroup if and only if \(\gcd (X)=1\).

If M is a submonoid of \((\mathbb {N},+)\) and \(M=\langle X \rangle \), then we say that X is a system of generators of M. Moreover, if \(M\not =\langle {Y} \rangle \) for any subset \(Y\subsetneq X\), then we say that X is a minimal system of generators of M.

The following result is [11, Corollary 2.8].

Lemma 2.1

If M is a submonoid of \((\mathbb {N},+)\), then M has a unique minimal system of generators that in addition is finite.

We denote by \(\hbox {msg}(M)\) the minimal system of generators of M. The next result is [11, Corollary 2.9].

Lemma 2.2

If M is a submonoid of \((\mathbb {N},+)\) generated by \(\{m_1<\cdots <m_e\}\) (with \(m_1\not =0\)), then \(\hbox {msg}(M)=\{m_1<\cdots <m_e\}\) if and only if \(m_{i+1}\notin \langle m_1,\ldots ,m_i \rangle \) for all \(i\in \{1,\ldots ,e-1\}\).

Let S be a numerical semigroup and \(n\in S\setminus \{0\}\). The Apéry set of n in S (named so in honour of [3]) is \(\hbox {Ap}(S,n)=\{s\in S\mid s-n\notin S\}\). The next result is [11, Lemma 2.4].

Lemma 2.3

Let S be a numerical semigroup and let \(n\in S\setminus \{0\}\). Then \(\hbox {Ap}(S,n)=\{w(0)=0,w(1),\ldots ,w(n-1)\}\), where w(i) is the least element of S congruent with i modulo n, for all \(i\in \{0,\ldots ,n-1\}\).

If S is a numerical semigroup and \(\hbox {Ap}(S,n)=\{w(0),w(1),\ldots ,w(n-1)\}\), then we use the notation \(\theta _n(S)=(w(1),\ldots ,w(n-1))\). Moreover, if \((x_1,\ldots ,x_r)\) and \((y_1,\ldots ,y_r)\) belong to \(\mathbb {N}^r\), then we define the operation

$$\begin{aligned} (x_1,\ldots ,x_r)\vee (y_1,\ldots ,y_r)=\left( \max \{x_1,y_1\},\ldots ,\max \{x_r,y_r\}\right) \end{aligned}$$

and we consider the usual product order

$$\begin{aligned} (x_1,\ldots ,x_r)\le (y_1,\ldots ,y_r) \text{ if } x_i\le y_i \text{ for } \text{ all } i\in \{1,\ldots ,r\}. \end{aligned}$$

The following result is [10, Corollary 4.5] and useful for proving Theorem 5.8.

Proposition 2.4

Let n be a positive integer and let \(\mathscr {S}_n = \{ S\in \mathscr {S} \mid n\in S \}\). Then:

  1. 1.

    \(\theta _n:\mathscr {S}_n \rightarrow \mathbb {N}^{n-1}\) is an injective application.

  2. 2.

    If \((x_1,\ldots ,x_{n-1})\in \textrm{Im}(\theta _n)\), then \(S=\langle x_1,\ldots ,x_{n-1},n \rangle \in \mathscr {S}_n\) and \(\theta _n(S)=(x_1,\ldots ,x_{n-1})\).

  3. 3.

    If \(\{S,T\}\subseteq \mathscr {S}_n\), then \(S\subseteq T\) if and only if \(\theta _n(T)\le \theta _n(S)\).

  4. 4.

    If \(\{S,T\}\subseteq \mathscr {S}_n\), then \(\theta _n(S\cap T)=\theta _n(S)\vee \theta _n(T)\).

Now, let A be a non-empty subset of \(\mathbb {N}\) and let B be a non-empty finite subset of \(\mathbb {N} \setminus \{0\}\) such that \(\langle A \rangle \cap B = \emptyset \). Let us consider the notation

  • \(\mathfrak {P}(B) = \{ (x_1,\ldots ,x_n) \mid x_1+\cdots +x_n \text{ is } \text{ a } \text{ partition } \text{ of } \text{ some } \text{ element } \text{ of } B\}\),

  • \(\mathfrak {G}(A,B) = \{ \{x_1,\ldots ,x_n\}{\setminus } \langle A \rangle \mid (x_1,\ldots ,x_n) \in \mathfrak {P}(B) \}\),

  • \(\mathfrak {L}(A,B) = \{ K \subseteq \mathbb {N} {\setminus } \{0\} \mid K\cap X \not = \emptyset \text{ for } \text{ all } X\in \mathfrak {G}(A,B) \}\),

  • \(\mathfrak {m}(A,B) = \hbox {Minimal}\big ( \mathfrak {L}(A,B) \big )\).

Observe that, with this notation, the question proposed in Problem 1.1 is equivalent to giving an algorithm for computing \(\mathfrak {m}(A,B)\).

Our next purpose is to prove that \(C \in \mathfrak {m}(A,B)\) if and only if \(\mathbb {N}\setminus C \in \mathscr {M}(A,B)\). To do so, we need the following three results.

Lemma 2.5

If \(C \in \mathfrak {m}(A,B)\), then the following conditions are satisfied.

  1. 1.

    \(B \subseteq C \subseteq \{1,\ldots ,\max (B)\}\setminus \langle A \rangle \).

  2. 2.

    If \(c\in C\), then there exists \(X\in \mathfrak {G}(A,B)\) such that \(C\cap X=\{c\}\).

  3. 3.

    If xy are positive integers and \(x+y\in C\), then \(C\cap \{x,y\}\not =\emptyset \).

  4. 4.

    If \(\{x,y\}\subseteq \mathbb {N}\setminus C\), then \(x+y \in \mathbb {N}\setminus C\).

Proof

  1. 1.

    It is trivial from the definitions.

  2. 2.

    If \(C \in \mathfrak {m}(A,B)\) and \(c\in C\), then \(C\setminus \{c\} \not \in \mathfrak {L}(A,B)\). Therefore, there exits \(X\in \mathfrak {G}(A,B)\) such that \((C{\setminus }\{c\}) \cap X = \emptyset \). Moreover, since \(C \in \mathfrak {m}(A,B)\), we have \(C \in \mathfrak {L}(A,B)\) and, consequently, \(C\cap X \not = \emptyset \). Thereby, we conclude that \(C\cap X=\{c\}\).

  3. 3.

    Let xy be positive integers such \(x+y\in C\). By applying the previous item, there exists \((x_1,\ldots ,x_n) \in \mathfrak {P}(B)\) such that \(x_1+\cdots +x_n = b\in B\) and

    $$\begin{aligned} C \cap \left( \{x_1,\ldots ,x_n\} \setminus \langle A \rangle \right) = \{x+y\}. \end{aligned}$$
    (1)

    Now, without loss of generality, we can suppose that \(x_1=\cdots =x_k=x+y\) and \(x_i\not =x+y\) for all \(i\in \{k+1,\ldots ,n\}\). Thus, \((x+y)+{\mathop {\cdots }\limits ^{(k)}}+(x+y)+x_{k+1}+\cdots +x_n=b\), that is, \(\{x,y,x_{k+1},\ldots ,x_n\} {\setminus } \langle A \rangle \in \mathfrak {G}(A,B)\) and, since \(C\in \mathfrak {L}(A,B)\), we have that

    $$\begin{aligned} C \cap \big ( \{x,y,x_{k+1},\ldots ,x_n\} \setminus \langle A \rangle \big ) \not = \emptyset . \end{aligned}$$
    (2)

    From (1)-(2) (and as \(x_i\not =x+y\) if \(k+1 \le i \le n\}\)), it is clear that \(C\cap \{x,y\}\not =\emptyset \).

  4. 4.

    This is a reformulation of the statement in the previous item.

\(\square \)

Proposition 2.6

If \(C\in \mathfrak {m}(A,B)\), then \(\mathbb {N} {\setminus } C \in \mathscr {S}(A,B)\). Moreover, we have that \(\langle A \rangle \subseteq \mathbb {N}{\setminus } C\) and \( (\mathbb {N}{\setminus } C) \cap B = \emptyset \).

Proof

First of all, by item 1. of Lemma 2.5, we know that \(\mathbb {N} \setminus C\) is a finite set such that \(0 \in \mathbb {N} {\setminus } C\). Secondly, by item 4. of Lemma 2.5, we have that \(\mathbb {N} \setminus C\) is closed under addition. Therefore, \(\mathbb {N} \setminus C\) is a numerical semigroup.

Finally, and again by item 1. of Lemma 2.5, we can conclude that \(\langle A \rangle \subseteq \mathbb {N} {\setminus } C\) and \((\mathbb {N} {\setminus } C) \cap B = \emptyset \). \(\square \)

Proposition 2.7

If S is a numerical semigroup such that \(A\subseteq S\) and \(S\cap B=\emptyset \), then \(\mathbb {N}{\setminus } S \in \mathfrak {L}(A,B)\).

Proof

If we take \(K=\mathbb {N}\setminus S\), then it is clear that \(K \subseteq \mathbb {N}{\setminus } \{0\}\). Thus, to finish the proof, it is enough to see that, if \(X\in \mathfrak {G}(A,B)\), then \(K\cap X\not =\emptyset \).

Let \(X = \{x_1,\ldots ,x_n\}{\setminus } \langle A \rangle \in \mathfrak {G}(A,B)\). By hypothesis, if \(x_1+\cdots +x_n\) is a partition of \(b\in B\), then \(x_1+\cdots +x_n\not \in S\). Thus, there exists \(i\in \{1,\ldots ,n\}\) such that \(x_i\not \in S\), that is, \(x_i\in \mathbb {N}\setminus S=K\). In addition, \(x_i\not \in \langle A \rangle \) and, consequently, \(x_i\in X\). Thereby, \(x_i\in K\cap X\). \(\square \)

We are now ready to show the result that allows us to translate Problem 1.1 into a question on numerical semigroups.

Theorem 2.8

Let C be a subset of \(\mathbb {N} \setminus \{0\}\). Then \(C\in \mathfrak {m}(A,B)\) if and only if \(\mathbb {N} {\setminus } C \in \mathscr {M}(A,B)\).

Proof

(Necessity.) From Proposition 2.6, we know that \(\mathbb {N} \setminus C\in \mathscr {S}(A,B)\). Now, let us suppose that there exists \(S\in \mathscr {S}(A,B)\) such that \(\mathbb {N} {\setminus } C \subseteq S\). Then, by Proposition 2.7, we have that \(\mathbb {N} \setminus S \in \mathfrak {L}(A,B)\). But, since \(C\in \mathfrak {m}(A,B)\) and \(\mathbb {N} \setminus S \subseteq C\), we have that \(C=\mathbb {N} \setminus S\) or, equivalently, that \(\mathbb {N} \setminus C=S\). Thus, we conclude that \(\mathbb {N} {\setminus } C \in \mathscr {M}(A,B)\).

(Sufficiency.) By applying Proposition 2.7, we have that, if \(\mathbb {N} \setminus C \in \mathscr {M}(A,B)\), then \(C\in \mathfrak {L}(A,B)\). Now, let us assume that there exists \(D\in \mathfrak {m}(A,B)\) such that \(D\subseteq C\). Then, \(\mathbb {N}\setminus C \subseteq \mathbb {N}\setminus D\) and, by Proposition 2.6, \(\mathbb {N}{\setminus } D \in \mathscr {S}(A,B)\). Therefore, \(\mathbb {N}{\setminus } C = \mathbb {N}{\setminus } D\) and, consequently, \(C=D\). Thus, \(C\in \mathfrak {m}(A,B)\). \(\square \)

As an immediate consequence of Theorem 2.8, we have the following result.

Corollary 2.9

Let A be a non-empty subset of \(\mathbb {N}\) and let B be a non-empty finite subset of \(\mathbb {N} \setminus \{0\}\). Then \(\mathfrak {m}(A,B)=\left\{ \mathbb {N}{\setminus } S \mid S \in \mathscr {M}(A,B) \right\} \).

3 The set \(\mathscr {I}\varvec{(A,F)}\)

In this section A is a non-empty subset of \(\mathbb {N}\) and F is a positive integer.

Proposition 3.1

\(\mathscr {S}(A,F)\not =\emptyset \) if and only if \(F\notin \langle A \rangle \).

Proof

(Necessity.) If \(\mathscr {S}(A,F)\not =\emptyset \), then there exists \(S\in \mathscr {S}(A,F)\). Therefore, \(\langle A \rangle \subseteq S\) and \(F\notin S\). Consequently, \(F\notin \langle A \rangle \).

(Sufficiency.) If \(F\notin \langle A \rangle \), then it is clear that \(S=\langle A \rangle \cup \{F+1,\rightarrow \}\) (where the symbol \(\rightarrow \) means that every integer greater than \(F+1\) belongs to the set S) is a numerical semigroup with Frobenius number equal to F. Therefore, \(\mathscr {S}(A,F)\not =\emptyset \). \(\square \)

The next result is [9, Theorem 1].

Lemma 3.2

If S is a numerical semigroup, then the following conditions are equivalent.

  1. 1.

    S is irreducible.

  2. 2.

    S is maximal in the set of all numerical semigroups with Frobenius number equal to \(\textrm{F}(S)\).

  3. 3.

    S is maximal in the set of all numerical semigroups that do not contain \(\textrm{F}(S)\).

Let us observe that, if S is a numerical semigroup, then \(\mathbb {N} \setminus S\) is a finite set. Therefore, there exists a finite number of numerical semigroups containing S. This fact, together with Proposition 3.1 and Lemma 3.2, allows us to state the next result.

Proposition 3.3

\(\mathscr {I}(A,F)\not =\emptyset \) if and only if \(F\notin \langle A \rangle \).

The following result is [5, Lemma 4].

Lemma 3.4

If S is a numerical semigroup with Frobenius number equal to F, then:

  1. 1.

    If \(h = \max \left\{ x\in \mathbb {N}{\setminus } S \mid F-x\notin S \text{ and } x\not =\frac{F}{2} \right\} \), then \(S\cup \{h\}\) is a numerical semigroup with Frobenius number equal to F.

  2. 2.

    S is irreducible if and only if \(\left\{ x\in \mathbb {N}{\setminus } S \mid F-x\notin S \text{ and } x\not =\frac{F}{2} \right\} = \emptyset \).

From the above lemma, we can easily deduce the next result.

Lemma 3.5

If S is a numerical semigroup with Frobenius number equal to F, then

$$\begin{aligned} \Delta (S) = S \cup \left\{ x\in \mathbb {N}\setminus S \mid F-x\notin S \text{ and } x>\frac{F}{2} \right\} \end{aligned}$$

is an irreducible numerical semigroup with Frobenius number equal to F.

From the proof of Proposition 3.1, we know that, if \(F\notin \langle A \rangle \), then \(\langle A \rangle \cup \{F+1,\rightarrow \} \in \mathscr {S}(A,F)\). Now, by applying Lemma 3.5, we have that \(\hbox {C}(A,F)=\Delta (\langle A \rangle \cup \{F+1,\rightarrow \}) \in \mathscr {I}(A,F)\).

The following result says that \(\hbox {C}(A,F)\) is the unique element of \(\mathscr {I}(A,F)\) in which all its minimal generators less than \(\frac{F}{2}\) belong to A.

Proposition 3.6

If \(F\notin \langle A \rangle \), then

$$\begin{aligned} \Big \{ S\in \mathscr {I}(A,F) \mid \left\{ x\in \textrm{msg}(S) \mid {\textstyle x<\frac{F}{2}} \right\} \subseteq A \Big \} = \{\textrm{C}(A,F)\}. \end{aligned}$$

Proof

If \(x \in \hbox {C}(A,F)\) and \(x<\frac{F}{2}\), then \(x\in \langle A \rangle \). Since \(\hbox {C}(A,F) \in \mathscr {I}(A,F)\), by applying Lemma 2.2, we have that

$$\begin{aligned} \{{\text {C}}(A,F)\} \subseteq \Big \{ S\in \mathscr {I}(A,F) \mid \left\{ x\in \hbox {msg}(S) \mid {\textstyle x<\frac{F}{2}} \right\} \subseteq A \Big \}. \end{aligned}$$

If \(S\in \mathscr {I}(A,F)\) and \(\left\{ x\in \hbox {msg}(S) \mid x<\frac{F}{2} \right\} \subseteq A\), then we deduce from Lemma 2.2 that \(S=\left( \langle A \rangle \cup \{F+1,\rightarrow \} \right) \cup X\), where \(X\subseteq \{ x\in \mathbb {N} \mid \frac{F}{2}< x < F \}\). Now, by applying item 2 of Lemma 3.4, we easily get that \(S=\hbox {C}(A,F)\). \(\square \)

The next result is well known (for instance, see [11]).

Lemma 3.7

If S is a numerical semigroup and \(x\in S\), then \(S{\setminus } \{x\}\) is a numerical semigroup if and only if \(x\in \textrm{msg}(S)\).

Let \(\mathbb {Z}\) and \(\mathbb {Q}\) be the sets of integers and rational numbers, respectively. If \(q\in \mathbb {Q}\), we use the notation \(\lceil q \rceil = \min \{z\in \mathbb {Z} \mid q\le z \}\). The following result can be deduced from [6, Lemma 2.4].

Lemma 3.8

If S is a numerical semigroup, then S is irreducible if and only if .

Note that, as a consequence of Proposition 3.6, if \(S\in \mathscr {I}(A,F){\setminus } \{\textrm{C}(A,F)\}\), then there exists \(\alpha (S)=\min \left\{ x\in \hbox {msg}(S) \mid x\notin A \text{ and } x<\frac{F}{2} \right\} \).

Proposition 3.9

If \(S\in \mathscr {I}(A,F)\setminus \{\textrm{C}(A,F)\}\), then \(\bar{S}=\left( S{\setminus }\{\alpha (S)\} \right) \cup \{F-\alpha (S)\} \in \mathscr {I}(A,F)\).

Proof

First of all, let us observe that the cardinality of \(\mathbb {N}\setminus \bar{S}\) is equal to \(\textrm{g}(S)\). Therefore, from Lemma 3.8, we can state that \(\bar{S}\in \mathscr {I}(A,F)\) if and only if \(\bar{S}\) is a numerical semigroup.

Now, from Lemma 3.7, we have that \(S\setminus \{\alpha (S)\}\) is a numerical semigroup. Thus, in order to assert that \(\bar{S}\) is a numerical semigroup, it suffices to verify that \(F-\alpha (S)+s\in \bar{S}\) for \(s=F-\alpha (S)\) or for all \(s\in S{\setminus }\{0,\alpha (S)\}\).

Firstly, and from its definition, \(\alpha (S)<\frac{F}{2}\) and then \(F-\alpha (S)>\frac{F}{2}\). Thereby, \(2(F-\alpha (S))>F\) and, consequently, \(2(F-\alpha (S))\in \bar{S}\).

Secondly, if \(s\in S\setminus \{0,\alpha (S)\}\) and \(F-\alpha (S)+s\notin S\), then, by item 2 of Lemma 3.4, we deduce that \(F-\left( F-\alpha (S)+s \right) \in S\) or \(F-\alpha (S)+s=\frac{F}{2}\). But, if \(F-\left( F-\alpha (S)+s \right) \in S\), then \(\alpha (S)-s\in S\) and, in consequence, \(\alpha (S)\notin \hbox {msg}(S)\), which is a contradiction. And, if \(F-\alpha (S)+s=\frac{F}{2}\), then \(\alpha (S)=\frac{F}{2}+s>\frac{F}{2}\), which is once again a contradiction. \(\square \)

If \(S\in \mathscr {I}(A,F)\), then Proposition 3.9 allows us to define the following sequence of elements in \(\mathscr {I}(A,F)\).

  • \(S_0=S\);

  • \(S_{n+1}=\left\{ \begin{array}{l} \left( S_n \setminus \{\alpha (S_n)\} \right) \cup \{F-\alpha (S_n)\}, \text{ if } S_n\not =\hbox {C}(A,F), \\ \quad \hbox {C}(A,F), \text{ otherwise. } \end{array} \right. \)

It is clear that there exists \(k\in \mathbb {N}\) such that \(S_k=\hbox {C}(A,F)\).

In order to compute the elements of \(\mathscr {I}(A,F)\), we use a tree structure on that set. To do so, let us recall some definitions and results.

A graph G is a pair (VE) where V is a non-empty set (whose elements are called the vertices of G) and E is a subset of \(\{(v,w) \in V \times V \mid v \ne w\}\) (whose elements are called the edges of G). A path (of length n) connecting the vertices x and y of G is a sequence of different edges \((v_0,v_1),(v_1,v_2),\ldots ,(v_{n-1},v_n)\) such that \(v_0=x\) and \(v_n=y\). We say that a graph G is a (directed rooted) tree if there exists a vertex r (known as the root of G) such that, for any other vertex x of G, there exists a unique path connecting x and r. If (xy) is an edge of the tree, then we say that x is a child of y. (For more details about trees, see [12, Chapter 9].)

We define the graph \(\hbox {G}\big (\mathscr {I}(A,F)\big )\) in the following way: \(\mathscr {I}(A,F)\) is the set of vertices and \((S,T)\in \mathscr {I}(A,F) \times \mathscr {I}(A,F)\) is an edge if \(T=\left( S \setminus \{\alpha (S)\} \right) \cup \{F-\alpha (S)\}\).

The next result is an immediate consequence of the definition of the sequence \(\{S_n\mid n\in \mathbb {N}\}\subseteq \mathscr {I}(A,F)\) given after Proposition 3.9.

Theorem 3.10

If \(F\notin \langle A \rangle \), then \(\textrm{G}\big (\mathscr {I}(A,F)\big )\) is a tree with root \(\textrm{C}(A,F)\).

It is clear that a tree can be built in a recurrent way by starting from its root and connecting each vertex with its children. Our next purpose is to show who are the children of a vertex of \(\hbox {G}\big (\mathscr {I}(A,F)\big )\).

The following result is [6, Proposition 2.5].

Lemma 3.11

Let S be an irreducible numerical semigroup with Frobenius number equal to F and let x be an element of \(\textrm{msg}(S)\) such that \(x<F\), \(2x-F\notin S\), \(3x\not =2F\), and \(4x\not =3F\). Then \(\bar{S}=\left( S \setminus \{x\} \right) \cup \{F-x\}\) is another irreducible numerical semigroup with Frobenius number equal to F.

It is obvious that \(\left\{ x\in \hbox {msg}\left( \hbox {C}(A,F)\right) \mid x\notin A \text{ and } x<\frac{F}{2} \right\} = \emptyset \). Thus, there does not exist \(\min \left\{ x\in \hbox {msg}\left( \hbox {C}(A,F)\right) \mid x\notin A \text{ and } x<\frac{F}{2} \right\} \). By definition, we consider that \(\alpha \left( \hbox {C}(A,F)\right) =+\infty \).

Let us build the children set of a numerical semigroup S belonging to the tree \(\hbox {G}\big (\mathscr {I}(A,F)\big )\).

Proposition 3.12

If \(S\in \mathscr {I}(A,F)\), then the children set of S, in the tree \(\hbox {G}\big (\mathscr {I}(A,F)\big )\), is

$$\begin{aligned} \Big \{ \big ( S \setminus \{x\} \big ) \cup \{F-x\} \mid x\in \textrm{msg}(S), \; \frac{F}{2}<x<F, \; x\notin A, \; 2x-F\notin S, \\ 3x\not =2F, \; 4x\not =3F, \, \text{ and } \; F-x<\alpha (S) \Big \}. \end{aligned}$$

Proof

Let \(x\in \hbox {msg}(S)\) such that \(\frac{F}{2}<x<F\), \(x\notin A\), \(2x-F\notin S\), \(3x\not =2F\), \(4x\not =3F\), and \(F-x<\alpha (S)\). By Lemma 3.11, we have that \(T=\left( S {\setminus } \{x\} \right) \cup \{F-x\} \in \mathscr {I}(A,F)\). Moreover, since \(F-x<\alpha (S)\), we have \(\alpha (T)=F-x\) and, as a result, \(S=\left( T {\setminus } \{\alpha (T)\} \right) \cup \{F-\alpha (T)\}\). Consequently, and having in mind that \(\alpha (T)\in \hbox {msg}(T)\), we conclude that T is a child of S.

Let us see the other inclusion. If T is a child of S, then \(S=\left( T \setminus \{\alpha (T)\} \right) \cup \{F-\alpha (T)\}\). Therefore, \(T=\left( S {\setminus } \{F-\alpha (T)\} \right) \cup \{F-\left( F-\alpha (T)\right) \}\). It is clear that \(F-\alpha (T)\in A\), \(\frac{F}{2}<F-\alpha <F\), and \(F-\left( F-\alpha (T)\right) <\alpha (S)\). In addition,

  • if \(F-\alpha (T)\in A\), then \(F\in T\);

  • if \(2(F-\alpha (T))-F\in S\), then \(F-2\alpha (T) \in S\) and, since \(2\alpha (T)\in S\), we have that \(F\in S\);

  • if \(3(F-\alpha (T))-F=2F\), then \(F=3\alpha (S)\in S\);

  • if \(4(F-\alpha (T))-F=3F\), then \(F=4\alpha (S)\in S\);

which are four contradictions and, thus, the proof is complete. \(\square \)

We are now in a position to show the algorithm for computing \(\mathscr {I}(A,F)\).

Algorithm 3.13

INPUT: \(A\subseteq \mathbb {N}\) and \(F\in \mathbb {N}\setminus \{0\}\) such that \(F\notin \langle A \rangle \). OUTPUT: \(\mathscr {I}(A,F)\).

  1. (1)

    \(X = \{ \textrm{C}(A,F) \}\).

  2. (2)

    \(Y = \Big \{ \big ( \textrm{C}(A,F) {\setminus } \{x\} \big ) \cup \{F-x\} \mid x\in \textrm{msg}(\textrm{C}(A,F)), \; \frac{F}{2}<x<F, \; x\notin A,\) \(2x-F\notin \textrm{C}(A,F), \; 3x\not =2F, \, \text{ and } \; 4x\not =3F \Big \}\).

  3. (3)

    If \(Y=\emptyset \), then return X.

  4. (4)

    \(X:= X\cup Y\).

  5. (5)

    For each \(S\in Y\), compute \(Y_S = \Big \{ \big ( S {\setminus } \{x\} \big ) \cup \{F-x\} \mid x\in \textrm{msg}(S),\) \( \frac{F}{2}<x<F, \; x\notin A, \; 2x-F\notin S, \; 3x\not =2F, \, 4x\not =3F, \; \text{ and } \; F-x<\alpha (S) \Big \}.\)

  6. (6)

    \(Y:=\bigcup _{S\in Y} Y_s\) and go to (3).

Let us illustrate how the above algorithm works by means of an example.

Example 3.14

Using Algorithm 3.13, let us compute \(\mathscr {I}(\{4\},11)\).

  • \(X = \{ \hbox {C}(\{4\},11) \} =\{ \langle 4,6,9 \rangle \}\).

  • \(Y = \left\{ \big ( \langle 4,6,9 \rangle {\setminus } \{6\} \big ) \cup \{11-6\}, \; \big ( \langle 4,6,9 \rangle {\setminus } \{9\} \big ) \cup \{11-9\} \right\} \Rightarrow \)\(Y = \left\{ \langle 4,5 \rangle , \langle 2,13 \rangle \right\} \).

  • \(X = \left\{ \langle 4,6,9 \rangle , \langle 4,5 \rangle , \langle 2,13 \rangle \right\} \).

  • \(Y_{\langle 4,5 \rangle } = \emptyset \), \(Y_{\langle 2,13 \rangle } = \emptyset \).

  • \(Y = \emptyset \).

  • Return \(\mathscr {I}(\{4\},11) = \left\{ \langle 4,6,9 \rangle , \langle 4,5 \rangle , \langle 2,13 \rangle \right\} \).

Remark 3.15

Observe that, if we take \(A=\{0\}\), then \(\mathscr {I}(\{0\},F)\) is the set of irreducible numerical semigroups with Frobenius number equal to F. Therefore, Algorithm 3.13 is a generalisation of the algorithm described in [6] for computing the irreducible numerical semigroups with fixed Frobenius number.

4 The set \(\mathscr {S}\varvec{(A,F)}\)

As in the previous section, in this one A is a non-empty subset of \(\mathbb {N}\) and F is a positive integer. Our main purpose here is to show an algorithm that allows us to compute \(\mathscr {S}(A,F)\).

Recall that, by Proposition 3.1, we know that \(\mathscr {S}(A,F)\not =\emptyset \) if and only if \(F\notin \langle A \rangle \). Moreover, by Lemma 3.5, we know that, if S is a numerical semigroup with Frobenius number F, then \(\Delta (S) = S \cup \left\{ x\in \mathbb {N}{\setminus } S \mid F-x\notin S \text{ and } x>\frac{F}{2} \right\} \) is an irreducible numerical semigroup with Frobenius number equal to F.

Let us define on \(\mathscr {S}(A,F)\) the equivalence relation

$$\begin{aligned} S \,\mathfrak {r}\, T \, \text{ if } \, \Delta (S)=\Delta (T). \end{aligned}$$

If \(S\in \mathscr {S}(A,F)\), then \([S] = \big \{ T\in \mathscr {S}(A,F) \mid S \,\mathfrak {r}\, T \big \}\) and it is well known that the quotient set \(\mathscr {S}(A,F)/\mathfrak {r}=\big \{ [S] \mid S\in \mathscr {S}(A,F) \big \}\) is a partition of \(\mathscr {S}(A,F)\).

In the following result we establish that there is a one-to-one correspondence between the sets \(\mathscr {I}(A,F)\) and \(\mathscr {S}(A,F)/\mathfrak {r}\).

Proposition 4.1

If \(F\notin \langle A \rangle \), then \(\mathscr {S}(A,F)/\mathfrak {r}=\big \{ [S] \mid S\in \mathscr {I}(A,F) \big \}\). Moreover, if \(\{S,T\}\subseteq \mathscr {I}(A,F)\) and \(S\not =T\), then \([S]\cap [T]=\emptyset \).

Proof

From Lemma 3.5, if \(S\in \mathscr {S}(A,F)\), then \(\Delta (S)\in \mathscr {I}(A,F)\). Moreover, it is clear that \(\Delta (S)=\Delta (\Delta (S))\). Therefore, \(\mathscr {S}(A,F)/\mathfrak {r}=\big \{ [S] \mid S\in \mathscr {I}(A,F) \big \}\).

Now, if \(\{S,T\}\subseteq \mathscr {I}(A,F)\) and \([S]\cap [T]\not =\emptyset \), then \(\Delta (S)=\Delta (T)\). But, since S and T are irreducible, we have \(S=\Delta (S)\) and \(T=\Delta (T)\). Thus, we conclude that \(S=T\). \(\square \)

As a consequence of Proposition 4.1, we have that, in order to build all the elements of \(\mathscr {S}(A,F)\), it is sufficient to have

  1. (i)

    an algorithm to build \(\mathscr {I}(A,F)\) and

  2. (ii)

    an algorithm that, given \(S\in \mathscr {I}(A,F)\), builds [S].

Since Algorithm 3.13 solves (i), we focus our attention on describing a procedure for solving (ii).

The next result has an easy proof and is therefore omitted.

Lemma 4.2

If \(S\in \mathscr {I}(A,F)\), then the following facts are true.

  1. 1.

    \(\max ([S])=S\) and \(\,\min ([S])=\left\langle A\cup \left\{ x\in S \mid x<\frac{F}{2}\right\} \right\rangle \cup \{F+1,\rightarrow \}\).

  2. 2.

    If T is a numerical semigroup, then \(T\in [S]\) if and only if \(\min ([S])\subseteq T \subseteq S\).

If \(S\in \mathscr {I}(A,F)\), then we use the notation \(\Gamma (S)=\min ([S])\) and \(\mathcal {D}(S)=S{\setminus }\Gamma (S)\). Moreover, as usual, if \(A,B\subseteq \mathbb {Z}\), then \(A+B = \{a+b \mid a\in A, \, b\in B\}\).

In the next result, for fixed \(S\in \mathscr {I}(A,F)\), we describe all the elements of [S].

Proposition 4.3

Let \(S\in \mathscr {I}(A,F)\) and let B be a subset of \(\mathcal {D}(S)\). Then \(\Gamma (S) \cup \left( \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S) \right) \in [S]\). Moreover, all the elements of [S] are built in this way.

Proof

Let \(\bar{S} = \Gamma (S) \cup \left( \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S) \right) \). Then \(\Gamma (S) \subseteq \bar{S} \subseteq S\) and therefore, from Lemma 4.2, if we see that \(\bar{S}\) is a numerical semigroup, then we will get that \(\bar{S}\in [S]\).

First of all, since \(\Gamma (S) \subseteq \bar{S}\), we have that \(0 \in \bar{S}\) and \(\mathbb {N} {\setminus } \bar{S} \subseteq \mathbb {N} {\setminus } \Gamma (S)\). Thus, \(0 \in \bar{S}\) and \(\mathbb {N} {\setminus } \bar{S}\) is finite.

Secondly, we have to see that \(\bar{S}\) is closed under addition. For this we have three possibilities.

  • If \(x,y \in \Gamma (S)\), then \(x+y \in \Gamma (S) \subseteq \bar{S}\).

  • If \(x,y \in \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S)\), then \(x,y \in \mathcal {D}(S)\) and, thereby, \(x,y > \frac{F}{2}\). Thus, \(x+y > F\) and, consequently, \(x+y \in \Gamma (S) \subseteq \bar{S}\).

  • Let us take \(x \in \Gamma (S)\) and \(y \in \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S)\). Then we have that \(y=y_1+y_2\), with \(y_1\in B\) and \(y_2\in \Gamma (S)\), and, therefore, \(x+y \in B+\Gamma (S)\). Now,

    1. *

      on the one hand, if \(x+y \in \mathcal {D}(S)\), then \(x+y \in \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S) \subseteq \bar{S}\),

    2. *

      and, on the other hand, if \(x+y \not \in \mathcal {D}(S)\), then \(x+y \in \Gamma (S) \subseteq \bar{S}\) (observe that \(x+y\in S\) because \(x\in \Gamma (S)\subseteq S\) and \(y\in \mathcal {D}(S)\subseteq S\)).

Now, let T be a numerical semigroup such that \(T\in [S]\). From Lemma 4.2, we have that \(\Gamma (S)\subseteq T \subseteq S\) and, therefore, \(T = \Gamma (S) \cup B\) for some set \(B \subseteq \mathcal {D}(S)\). Then, having in mind that T is a numerical semigroup, we get that \(T=\Gamma (S) \cup \left( \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S) \right) \). Effectively, it is clear that \(B \subseteq \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S)\), but

$$\begin{aligned}{} & {} \big (B+\Gamma (S)\big ) \cap \mathcal {D}(S) \subseteq T \cap \mathcal {D}(S) = \big ( \Gamma (S) \cup B \big ) \cap \mathcal {D}(S) = \\{} & {} \big ( \Gamma (S) \cap \mathcal {D}(S) \big ) \cup \big ( B \cap \mathcal {D}(S) \big ) = \emptyset \cup B = B. \end{aligned}$$

Thus, we have completed the proof. \(\square \)

Let us note that, if \(\Gamma (S)=S\) for some \(S\in \mathscr {I}(A,F)\), then \(\mathcal {D}(S) = \emptyset \). Otherwise, if \(d\in \mathcal {D}(S)\), then we use the notation \(\hbox {T}(d) = \left( \{d\}+\Gamma (S) \right) \cap \mathcal {D}(S)\). Moreover, if \(B\subseteq \mathcal {D}(S)\), then \(\hbox {T}(B) = \cup _{b\in B} \hbox {T}(b)\). The following result is a reformulation of Proposition 4.3 using this new notation.

Proposition 4.4

If \(S\in \mathscr {I}(A,F)\) and \(\mathcal {K}(S) = \{ \textrm{T}(B) \mid B\subseteq \mathcal {D}(S) \}\), then \([S] = \left\{ \Gamma (S)\cup X \mid X\in \mathcal {K}(S) \right\} \).

We are ready to show the algorithm for computing [S] when \(S\in \mathscr {I}(A,F)\).

Algorithm 4.5

INPUT: \(S \in \mathscr {I}(A,F)\).

OUTPUT: [S].

  1. (1)

    Compute \(\Gamma (S)\) and \(\mathcal {D}(S)\).

  2. (2)

    Compute \(\mathcal {K}(S) = \{ \textrm{T}(B) \mid B\subseteq \mathcal {D}(S) \}\).

  3. (3)

    Return \([S] = \left\{ \Gamma (S)\cup X \mid X\in \mathcal {K}(S) \right\} \).

Remark 4.6

The results of this section allow us to have an algorithmic process to compute \(\mathscr {S}(A,F)\). Specifically, \(\mathscr {S}(A,F) = \cup _{S\in \mathscr {I}(A,F)}[S]\). Moreover, since \(\mathscr {S}(\{0\},F)\) is the set of numerical semigroups with Frobenius number equal to F, this process is a generalisation of the algorithm shown in [5] for computing all the numerical semigroups with a given Frobenius number.

Let us illustrate with an example how the above algorithmic process works.

Example 4.7

Let us compute \(\mathscr {S}(\{4\},11)\).

  • From Example 3.14, we have that \(\mathscr {I}(\{4\},11) = \left\{ \langle 2,13 \rangle , \langle 4,5 \rangle , \langle 4,6,9 \rangle \right\} \).

  • If \(S=\langle 2,13 \rangle \), then \(\Gamma (S)=S\) and \(\mathcal {D}(S)=\emptyset \). Thus, \([\langle 2,13 \rangle ] = \{ \langle 2,13 \rangle \}\).

  • If \(S=\langle 4,5 \rangle \), then \(\Gamma (S)=S\) and \(\mathcal {D}(S)=\emptyset \). Thus, \([\langle 4,5 \rangle ] = \{ \langle 4,5 \rangle \}\).

  • If \(S=\langle 4,6,9 \rangle \), then \(\Gamma (S)=\langle 4,13,14,15 \rangle \) and \(\mathcal {D}(S)=\{6,9,10\}\).

    1. *

      If \(B=\emptyset \), then \(\textrm{T}(B)=\emptyset \).

    2. *

      If \(B=\{6\}\), then \(\textrm{T}(B)=\{6,10\}\).

    3. *

      If \(B=\{9\}\), then \(\textrm{T}(B)=\{9\}\).

    4. *

      If \(B=\{10\}\), then \(\textrm{T}(B)=\{10\}\).

    5. *

      If \(B=\{6,9\}\), then \(\textrm{T}(B)=\textrm{T}(\{6\})\cup \textrm{T}(\{9\})=\{6,9,10\}\).

    6. *

      If \(B=\{6,10\}\), then \(\textrm{T}(B)=\textrm{T}(\{6\})\cup \textrm{T}(\{10\})=\{6,10\}\).

    7. *

      If \(B=\{9,10\}\), then \(\textrm{T}(B)=\textrm{T}(\{9\})\cup \textrm{T}(\{10\})=\{9,10\}\).

    8. *

      If \(B=\{6,9,10\}\), then \(\textrm{T}(B)=\textrm{T}(\{6\})\cup \textrm{T}(\{9\})\cup \textrm{T}(\{10\})=\{6,9,10\}\).

    Thus, \(\mathcal {K}(S) = \left\{ \emptyset , \{9\}, \{10\}, \{6,10\}, \{9,10\}, \{6,9,10\} \right\} \).

    1. *

      If \(X=\emptyset \), then \(\Gamma (S)\cup X=\langle 4,13,14,15 \rangle \).

    2. *

      If \(X=\{9\}\), then \(\Gamma (S)\cup X=\langle 4,9,14,15 \rangle \).

    3. *

      If \(X=\{10\}\), then \(\Gamma (S)\cup X=\langle 4,10,13,15 \rangle \).

    4. *

      If \(X=\{6,10\}\), then \(\Gamma (S)\cup X=\langle 4,6,13,15 \rangle \).

    5. *

      If \(X=\{9,10\}\), then \(\Gamma (S)\cup X=\langle 4,9,10,15 \rangle \).

    6. *

      If \(X=\{6,9,10\}\), then \(\Gamma (S)\cup X=\langle 4,6,9 \rangle \).

    Thereby,

    $$\begin{aligned}{}[\langle 4,6,9 \rangle ] = \{ \langle 4,6,9 \rangle , \langle 4,6,13,15 \rangle , \langle 4,9,10,15 \rangle , \\ \langle 4,9,14,15 \rangle , \langle 4,10,13,15 \rangle , \langle 4,13,14,15 \rangle \}. \end{aligned}$$

In conclusion,

$$\begin{aligned} \mathscr {S}(\{4\},11) = \{ \langle 2,13 \rangle , \langle 4,5 \rangle , \langle 4,6,9 \rangle , \langle 4,6,13,15 \rangle , \langle 4,9,10,15 \rangle , \\ \langle 4,9,14,15 \rangle , \langle 4,10,13,15 \rangle , \langle 4,13,14,15 \rangle \}. \end{aligned}$$

5 The set \(\mathscr {M}\varvec{(A,B)}\)

In this section A is a non-empty subset of \(\mathbb {N}\) and B is a non-empty finite subset of \(\mathbb {N} \setminus \{0\}\).

Firstly, we give an easy result.

Proposition 5.1

\(\mathscr {S}(A,B)\not =\emptyset \) if and only if \(B\cap \langle A \rangle =\emptyset \).

Proof

If \(S\in \mathscr {S}(A,B)\), then \(\langle A \rangle \subseteq S\) and \(B\cap S=\emptyset \). Therefore, \(B\cap \langle A \rangle =\emptyset \).

For the other implication, it is enough to note that, if \(B\cap \langle A \rangle =\emptyset \), then \(\langle A \rangle \cup \{\max (B)+1,\rightarrow \} \in \mathscr {S}(A,B)\). \(\square \)

As a consequence of Proposition 5.1 we have the following result.

Corollary 5.2

\(\mathscr {M}(A,B)\not =\emptyset \) if and only if \(B\cap \langle A \rangle =\emptyset \).

In the next result we see how \(\mathscr {S}(A,B)\) can be built from the elements of B.

Proposition 5.3

If \(B=\{b_1,\ldots ,b_r\}\), then

$$\begin{aligned} \mathscr {S}(A,B) = \left\{ S_1\cap \ldots \cap S_r \mid S_i\in \mathscr {S}(A,\{b_i\}), \; 1 \le i \le r \right\} . \end{aligned}$$

Proof

Firstly, it is clear that, if \(S_i\in \mathscr {S}(A,\{b_i\})\) for all \(i\in \{1,\ldots ,r\}\), then \(S_1\cap \ldots \cap S_r \in \mathscr {S}(A,B)\).

Secondly, if \(S \in \mathscr {S}(A,B)\), then \(S \in \mathscr {S}(A,\{b_i\})\) for all \(i\in \{1,\ldots ,r\}\). Consequently, by setting \(S_1=\cdots =S_r=S\), we have that \(S=S_1\cap \ldots \cap S_r\) with \(S_i \in \mathscr {S}(A,\{b_i\})\) for all \(i\in \{1,\ldots ,r\}\). \(\square \)

The following lemma is clear from the definitions.

Lemma 5.4

If b is a positive integer, \(b\notin \langle A \rangle \), and \(S\in \mathscr {S}(A,\{b\})\), then there exists \(T\in \mathscr {M}(A,\{b\})\) such that \(S\subseteq T\).

Let us now see how \(\mathscr {M}(A,B)\) can be built from the elements of B.

Theorem 5.5

If \(B=\{b_1,\ldots ,b_r\}\), then

$$\begin{aligned} \mathscr {M}(A,B) = \textrm{Maximal}\big (\left\{ S_1\cap \ldots \cap S_r \mid S_i\in \mathscr {M}(A,\{b_i\}), \; 1 \le i \le r \right\} \big ). \end{aligned}$$

Proof

If \(S\in \mathscr {M}(A,B)\), then \(S\in \mathscr {S}(A,B)\) and, by Proposition 5.3, there exists \(S_i\in \mathscr {S}(A,\{b_i\})\), \(i\in \{1,\ldots ,r\}\), such that \(S=S_1\cap \ldots \cap S_r\). Moreover, from Lemma 5.4, there exists \(T_i\in \mathscr {S}(M,\{b_i\})\), \(i\in \{1,\ldots ,r\}\), such that \(S_i\subseteq T_i\). Thus, if \(T=T_1\cap \ldots \cap T_r\), then \(S\subseteq T\) and, again by Proposition 5.3, we have that \(T\in \mathscr {S}(A,B)\). Thereby, since \(S\in \mathscr {M}(A,B)\), we conclude that \(S=T\) and, consequently,

$$\begin{aligned} \mathscr {M}(A,B) \subseteq \left\{ S_1\cap \ldots \cap S_r \mid S_i\in \mathscr {M}(A,\{b_i\}), \; 1 \le i \le r \right\} . \end{aligned}$$

Now, from Proposition 5.3, we have that

$$\begin{aligned} \left\{ S_1\cap \ldots \cap S_r \mid S_i\in \mathscr {M}(A,\{b_i\}), \; 1 \le i \le r \right\} \subseteq \mathscr {S}(A,B). \end{aligned}$$

From here, the conclusion follows immediately. \(\square \)

The next result is easy to verify.

Lemma 5.6

If S and T are numerical semigroups, then \(\textrm{F}(S\cap T)\) is equal to \(\max \{\textrm{F}(S),\textrm{F}(T)\}\).

In the following result we determine \(\mathscr {M}(A,\{b\})\).

Proposition 5.7

If b is a positive integer such that \(b\notin \langle A \rangle \), then \(\mathscr {M}(A,\{b\}) = \mathscr {I}(A,b)\).

Proof

If \(S\in \mathscr {M}(A,\{b\})\), then we can easily deduce that \(A\subseteq S\) and \({\hbox {F}}(S)=b\). Let us suppose now that S is not irreducible. In such a case, there exist two numerical semigroups, \(T_1\) and \(T_2\), such that \(S\subsetneq T_1\), \(S\subsetneq T_2\), and \(S=T_1\cap T_2\). From Lemma 5.6, we know that \(\hbox {F}(S)=\max \{\hbox {F}(T_1),\hbox {F}(T_2)\}\). In particular, and without loss of generality, we can assume that \(\hbox {F}(S)=\hbox {F}(T_1)\). Thus, \(T_1\in \mathscr {S}(A,\{b\})\), \(S\subsetneq T_1\), and hence \(S\notin \mathscr {M}(A,\{b\})\), which is a contradiction.

For the reverse inclusion, let us take \(S\in \mathscr {I}(A,b)\) and \(T\in \mathscr {S}(A,\{b\})\) such that \(S\subseteq T\). Then, by item 3 of Lemma 3.2, we get that \(S=T\) and, thereby, \(S\in \mathscr {M}(A,\{b\})\). \(\square \)

As a consequence of Theorem 5.5 and Propositions 2.4 and 5.7, we have the next result. Recall that, if \(\hbox {Ap}(S,n)=\{w(0),w(1),\ldots ,w(n-1)\}\), then we use the notation \(\theta _n(S)=(w(1),\ldots ,w(n-1))\).

Theorem 5.8

If \(B=\{b_1,\ldots ,b_r\}\) and \(n=\max (B)+1\), then

$$\begin{aligned} \mathscr {M}(A,B) = \big \{ S\in \mathscr {S}_n \mid \theta _n(S)\in \textrm{Minimal}(\Theta (A,B)) \big \} \end{aligned}$$

where \(\Theta (A,B) = \left\{ \theta (S_1)\vee \cdots \vee \theta (S_r) \mid S_i\in \mathscr {I}(A,b_i), 1\le i\le r \right\} \).

If S is a numerical semigroup and \(n\in S\setminus \{0\}\), then we can obtain a list \([x_0,\ldots ,x_{n-1}]\) such that \(\hbox {Ap}(S,n) = \{w(0)=x_0,\ldots ,w(n-1)=x_{n-1}\}\) by using the function AperyListOfNumericalSemigroupWRTElement(S,n) of [7]. Thus, we have an algorithmic procedure for computing \(\theta _n(S)\) from a minimal system of generators of S and an element \(n\in S\setminus \{0\}\).

Let us now show the algorithm for computing \(\mathscr {M}(A,B)\).

Algorithm 5.9

INPUT: A (non-empty subset of \(\mathbb {N}\)) and \(B=\{b_1,\ldots ,b_r\}\) (non-empty finite subset of \(\mathbb {N} \setminus \{0\}\)) such that \(\langle A \rangle \cap B=\emptyset \).

OUTPUT: \(\mathscr {M}(A,B)\).

  1. (1)

    Using Algorithm 3.13, compute \(\mathscr {I}(A,b_i)\) for all \(i\in \{1,\ldots ,r\}\).

  2. (2)

    \(n=\max (B)+1\).

  3. (3)

    For each \(i\in \{1,\ldots ,r\}\), compute \(E_i=\{ \theta _n(S) \mid S\in \mathscr {I}(A,b_i) \}\).

  4. (4)

    \(E=\left\{ \alpha _1\vee \cdots \vee \alpha _r \mid \alpha _i\in E_i \text{ for } \text{ all } i\in \{1,\ldots ,r\} \right\} \).

  5. (5)

    \(\mathscr {E} = \textrm{Minimal}(E)\).

  6. (6)

    Return \(\big \{ \langle \{x_1,\ldots ,x_{n-1},n\} \rangle \mid (x_1,\ldots ,x_{n-1})\in \mathscr {E} \big \}\).

Remark 5.10

In [10] there is an algorithm given that allows us to compute all the numerical semigroups which are maximal in the set of numerical semigroups whose intersection with B is empty. Considering that this set is \(\mathscr {M}(\{0\},B)\), we have that Algorithm 5.9 is a generalisation of the algorithm seen in [10].

Let us see, in an example, how Algorithm 5.9 works.

Example 5.11

Let us compute \(\mathscr {M}(\{4,9\},\{11,14\})\).

  • From Algorithm 3.13, we have that

    1. *

      \(\mathscr {I}(\{4,9\},11) = \left\{ \langle 4,15 \rangle , \langle 4,6,9 \rangle \right\} \).

    2. *

      \(\mathscr {I}(\{4,9\},14) = \left\{ \langle 4,9,11 \rangle \right\} \).

  • \(n=\max (\{11,14\})+1=15\).

  • Let \(b_1=11\) and \(b_2=14\).

    1. *

      \(E_1=\{\alpha _{11},\alpha _{12}\} = \{ (16,17,18,4,20,6,22,8,9,10,26,12,13,14), (16,17,18,4,5,21,22,8,9,10,26,12,13,14) \}\).

    2. *

      \(E_2=\{\alpha _2\} = \{ (16,17,18,4,20,21,22,8,9,25,11,12,13,29) \}\).

  • \(E=\left\{ \alpha _{11}\vee \alpha _2, \alpha _{12}\vee \alpha _2\right\} = \{(16,17,18,4,20,21,22,8,9,25,26,12,13,29)\}\).

  • \(\mathscr {E} = \{(16,17,18,4,20,21,22,8,9,25,26,12,13,29)\}\).

  • \(\mathscr {M}(\{4,9\},\{11,14\}) = \left\{ \langle 15,16,17,18,4,20,21,22,8,9,25,26,12,13,29 \rangle \right\} \).

In conclusion,

$$\begin{aligned} \mathscr {M}(\{4,9\},\{11,14\}) = \left\{ \langle 4,9,15 \rangle \right\} . \end{aligned}$$

6 The algorithm

We are now in a position to show the algorithm for computing \(\mathfrak {m}(A,B)\) and, in this way, give an answer to Problem 1.1.

Algorithm 6.1

INPUT: A (non-empty subset of \(\mathbb {N}\)) and B (non-empty finite subset of \(\mathbb {N} \setminus \{0\}\)) such that \(\langle A \rangle \cap B=\emptyset \).

OUTPUT: \(\mathfrak {m}(A,B)\).

  1. (1)

    Using Algorithm 5.9, compute \(\mathscr {M}(A,B)\).

  2. (2)

    Return \( \{ \mathbb {N}\setminus S \mid S \in \mathscr {M}(A,B) \} \).

Remark 6.2

In [10] there is an algorithm given that computes all sets \(C \subseteq \mathbb {N}\setminus \{0\}\) that are minimal with the condition that, if \((x_1,\ldots ,x_n) \in \mathfrak {P}(B)\), then \(\{x_1,\ldots ,x_n\} \cap C \not = \emptyset \). Let us observe that such sets are nothing but the elements of \(\mathfrak {m}(\{0\},B)\). Therefore, Algorithm 6.1 is a generalisation of the algorithm seen in [10].

Example 6.3

From Example 5.11 we deduce that a set K satisfies the conditions

  • \(K \cap \langle 4,9 \rangle = \emptyset \),

  • for every partition of 11 or 14, there is at least one summand that belongs to K,

if and only if K contains the set \(\mathbb {N} {\setminus } \langle 4,9,15 \rangle = \{1,2,3,5,6,7,10,11,14\}\).