<Appendix><Heading>Generalities</Heading>

Here we describe some functions which are not specific for numerical
semigroups but are used to do computations with them. As they may have
interest by themselves, we decribe them here.

<Section><Heading>Bézout sequences</Heading>

A sequence of positive rational numbers <M> a_1/b_1 &lt; \cdots &lt; 
a_n/b_n</M> with <M>a_i,b_i</M> positive integers is a <E>Bézout sequence</E> 
if <M> a_{i+1}b_i - a_i b_{i+1}=1</M> for all <M>i\in \{1,\ldots,n-1\}</M>.

<P/>
The following function uses an algorithm presented in <Cite Key="Ros05"></Cite>.

 <ManSection>
<Func Name="BezoutSequence" Arg="arg"/>
<Description>
<A>arg</A> consits of two rational numbers or a list of two rational
numbers. The output is a Bézout sequence with ends the two rational numbers
given.
(Warning: rational numbers are silently transformed into irreducible
fractions.)

<Example><![CDATA[
gap> BezoutSequence(4/5,53/27);
[ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/6, 13/7, 15/8, 17/9, 19/10, 21/11, 23/12,
  25/13, 27/14, 29/15, 31/16, 33/17, 35/18, 37/19, 39/20, 41/21, 43/22,
  45/23, 47/24, 49/25, 51/26, 53/27 ]

]]></Example>
</Description>
</ManSection>
 <ManSection>
<Func Name="IsBezoutSequence" Arg="L"/>
<Description>
<A>L</A> is a list of rational numbers. <C>IsBezoutSequence</C> returns
<K>true</K> or <K>false</K> according to whether <A>L</A> is a Bézout
sequence or not.

<Example><![CDATA[
gap> IsBezoutSequence([ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/6]);
true
gap> IsBezoutSequence([ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/3]);
Take the 6 and the 7 elements of the sequence
false
]]></Example>
</Description>
</ManSection>

<ManSection>
<Func Name="CeilingOfRational" Arg="r"/>
<Description>
Returns the smallest integer greater than or equal to the rational  <A>r</A>.
<Example><![CDATA[
gap> CeilingOfRational(3/5);
1
]]></Example>
</Description>
</ManSection>

</Section>

<Section><Heading>Periodic subadditive functions</Heading>
A periodic function <M>f</M> of period <M>m</M> from the set <M> {\mathbb N}
</M> of 
natural numbers into itself may be specified through a list of <M>m</M>
natural numbers. The function <M>f</M> is said to be <E>subadditive</E> if 
<M>f(i+j)\leq f(i)+f(j)</M> and <M>f(0)=0</M>.

<ManSection>
<Func Name="RepresentsPeriodicSubAdditiveFunction" Arg="L"/>
<Description>
<A>L</A> is a list of integers. <C>RepresentsPeriodicSubAdditiveFunction</C> returns
<K>true</K> or <K>false</K> according to whether <A>L</A> represents a
periodic subAdditive function <M>f</M> periodic of period <M>m</M> or not.
To avoid defining <M>f(0)</M> (which we assume to be 0) we 
define <M>f(m)=0</M> and so the last element of the list must be 0.
This technical need is due to the fact that positions
in a list must be positive (not a 0).
<Example><![CDATA[
gap> RepresentsPeriodicSubAdditiveFunction([1,2,3,4,0]);
true
]]></Example>

</Description> 

</ManSection>



</Section>

</Appendix>
