Adding and removing elements of a numerical semigroup In this section we show how to construct new numerical semigroups from a given numerical semigroup. Two dual operations are presented. The first one removes a minimal generator from a numerical semigroup. The second adds a special gap to a semigroup (see ). S is a numerical semigroup and n is one if its minimal generators.

The output is the numerical semigroup S \setminus\{n\} (see ; S\setminus\{n\} is a numerical semigroup if and only if n is a minimal generator of S).
gap> s:=NumericalSemigroup(3,5,7); <Numerical semigroup with 3 generators> gap> RemoveMinimalGeneratorFromNumericalSemigroup(7,s); <Numerical semigroup with 3 generators> gap> MinimalGeneratingSystemOfNumericalSemigroup(last); [ 3, 5 ]
S is a numerical semigroup and g is a special gap of S.

The output is the numerical semigroup S \cup\{g\} (see , where it is explained why this set is a numerical semigroup).
gap> s:=NumericalSemigroup(3,5,7);; gap> s2:=RemoveMinimalGeneratorFromNumericalSemigroup(5,s); <Numerical semigroup with 3 generators> gap> s3:=AddSpecialGapOfNumericalSemigroup(5,s2); <Numerical semigroup> gap> SmallElementsOfNumericalSemigroup(s) = > SmallElementsOfNumericalSemigroup(s3); true gap> s=s3; true