Debian Codegraph @

doc/ref/chap16.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <head>
8 <title>GAP (ref) - Chapter 16: Combinatorics</title>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10 <meta name="generator" content="GAPDoc2HTML" />
11 <link rel="stylesheet" type="text/css" href="manual.css" />
12 <script src="manual.js" type="text/javascript"></script>
13 <script type="text/javascript">overwriteStyle();</script>
14 </head>
15 <body class="chap16" onload="jscontent()">
16
17
18 <div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
19
20 <div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap15.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap17.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap16_mj.html">[MathJax on]</a></p>
23 <p><a id="X7BDA99EE7CEADA7C" name="X7BDA99EE7CEADA7C"></a></p>
24 <div class="ChapSects"><a href="chap16.html#X7BDA99EE7CEADA7C">16 <span class="Heading">Combinatorics</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap16.html#X800E48927D5C83F5">16.1 <span class="Heading">Combinatorial Numbers</span></a>
26 </span>
27 <div class="ContSSBlock">
28 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X87665F748594BF29">16.1-1 Factorial</a></span>
29 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7A9AF5F58682819D">16.1-2 Binomial</a></span>
30 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7DC5667580522BDA">16.1-3 Bell</a></span>
31 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X792FF6EA786A5C2B">16.1-4 Bernoulli</a></span>
32 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X85037456785BB33C">16.1-5 Stirling1</a></span>
33 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7C93E14D7BC360F0">16.1-6 Stirling2</a></span>
34 </div></div>
35 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap16.html#X81B4696585C38147">16.2 <span class="Heading">Combinations, Arrangements and Tuples</span></a>
36 </span>
37 <div class="ContSSBlock">
38 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X8770F16D794C0ADB">16.2-1 Combinations</a></span>
39 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X78DD5C0D81057540">16.2-2 <span class="Heading">Iterator and enumerator of combinations</span></a>
40 </span>
41 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X82A6E98C85714FD0">16.2-3 NrCombinations</a></span>
42 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7837B3357C7566C8">16.2-4 Arrangements</a></span>
43 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7DE1ABD47D19F140">16.2-5 NrArrangements</a></span>
44 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X81601C6786120DDC">16.2-6 UnorderedTuples</a></span>
45 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7959281584C42C52">16.2-7 NrUnorderedTuples</a></span>
46 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X86A3CA0F7CC8C320">16.2-8 Tuples</a></span>
47 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7BA135297E8DA819">16.2-9 EnumeratorOfTuples</a></span>
48 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X86416A31807B0086">16.2-10 IteratorOfTuples</a></span>
49 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X85E18A9A87FD4CA2">16.2-11 NrTuples</a></span>
50 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7B0143FB83F359B7">16.2-12 PermutationsList</a></span>
51 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X8629A2908050EB3A">16.2-13 NrPermutationsList</a></span>
52 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X79C159507B2BF1C9">16.2-14 Derangements</a></span>
53 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7C1741B181A9AB9C">16.2-15 NrDerangements</a></span>
54 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7A13D8DC8204525F">16.2-16 PartitionsSet</a></span>
55 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7BCD7FC2876386F1">16.2-17 NrPartitionsSet</a></span>
56 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X84A6D15F8107008B">16.2-18 Partitions</a></span>
57 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X8793AEBD7E529E1D">16.2-19 IteratorOfPartitions</a></span>
58 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7ECDBC227BFB2EC6">16.2-20 <span class="Heading">Iterator and enumerator of unordered set partitions</span></a>
59 </span>
60 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X86933C4F795C4EBD">16.2-21 NrPartitions</a></span>
61 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X820DF201871F2723">16.2-22 OrderedPartitions</a></span>
62 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X80BB9F4982CA1E8B">16.2-23 NrOrderedPartitions</a></span>
63 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X8009520C82942461">16.2-24 PartitionsGreatestLE</a></span>
64 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7CB8D4FF8592A9BB">16.2-25 PartitionsGreatestEQ</a></span>
65 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7A70D4F3809494E7">16.2-26 RestrictedPartitions</a></span>
66 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X800B43838742FBF4">16.2-27 NrRestrictedPartitions</a></span>
67 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7F4EDCCA780B469D">16.2-28 SignPartition</a></span>
68 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7DB9BEB6856EC03D">16.2-29 AssociatedPartition</a></span>
69 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7A95D8A6820363A8">16.2-30 PowerPartition</a></span>
70 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X877D997B7F66A119">16.2-31 PartitionTuples</a></span>
71 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7F44AD098561DE32">16.2-32 NrPartitionTuples</a></span>
72 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X8796C1D783ED9CB4">16.2-33 BetaSet</a></span>
73 </div></div>
74 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap16.html#X83DC50B67D74E674">16.3 <span class="Heading">Fibonacci and Lucas Sequences</span></a>
75 </span>
76 <div class="ContSSBlock">
77 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X85AE1D70803A886C">16.3-1 Fibonacci</a></span>
78 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7830A03181D67192">16.3-2 Lucas</a></span>
79 </div></div>
80 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap16.html#X821888E77EB43F67">16.4 <span class="Heading">Permanent of a Matrix</span></a>
81 </span>
82 <div class="ContSSBlock">
83 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap16.html#X7F0942DD83BBAB7A">16.4-1 Permanent</a></span>
84 </div></div>
85 </div>
86
87 <h3>16 <span class="Heading">Combinatorics</span></h3>
88
89 <p>This chapter describes functions that deal with combinatorics. We mainly concentrate on two areas. One is about <em>selections</em>, that is the ways one can select elements from a set. The other is about <em>partitions</em>, that is the ways one can partition a set into the union of pairwise disjoint subsets.</p>
90
91 <p><a id="X800E48927D5C83F5" name="X800E48927D5C83F5"></a></p>
92
93 <h4>16.1 <span class="Heading">Combinatorial Numbers</span></h4>
94
95 <p><a id="X87665F748594BF29" name="X87665F748594BF29"></a></p>
96
97 <h5>16.1-1 Factorial</h5>
98
99 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Factorial</code>( <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
100 <p>returns the <em>factorial</em> <span class="SimpleMath">n!</span> of the positive integer <var class="Arg">n</var>, which is defined as the product <span class="SimpleMath">1 ⋅ 2 ⋅ 3 ⋯ n</span>.</p>
101
102 <p><span class="SimpleMath">n!</span> is the number of permutations of a set of <span class="SimpleMath">n</span> elements. <span class="SimpleMath">1 / n!</span> is the coefficient of <span class="SimpleMath">x^n</span> in the formal series <span class="SimpleMath">exp(x)</span>, which is the generating function for factorial.</p>
103
104
105 <div class="example"><pre>
106 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..10], Factorial );</span>
107 [ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800 ]
108 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factorial( 30 );</span>
109 265252859812191058636308480000000
110 </pre></div>
111
112 <p><code class="func">PermutationsList</code> (<a href="chap16.html#X7B0143FB83F359B7"><span class="RefLink">16.2-12</span></a>) computes the set of all permutations of a list.</p>
113
114 <p><a id="X7A9AF5F58682819D" name="X7A9AF5F58682819D"></a></p>
115
116 <h5>16.1-2 Binomial</h5>
117
118 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Binomial</code>( <var class="Arg">n</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
119 <p>returns the <em>binomial coefficient</em> <span class="SimpleMath">{n choose k}</span> of integers <var class="Arg">n</var> and <var class="Arg">k</var>. This is defined by the conditions <span class="SimpleMath">{n choose k} = 0</span> for <span class="SimpleMath">k &lt; 0</span>, <span class="SimpleMath">{0 choose k} = 0</span> for <span class="SimpleMath">k ≠ 0</span>, <span class="SimpleMath">{0 choose 0} = 1</span> and the relation <span class="SimpleMath">{n choose k} = {n-1 choose k} + {n-1 choose k-1}</span> for all <span class="SimpleMath">n</span> and <span class="SimpleMath">k</span>.</p>
120
121 <p>There are many ways of describing this function. For example, if <span class="SimpleMath">n ≥ 0</span> and <span class="SimpleMath">0 ≤ k ≤ n</span>, then <span class="SimpleMath">{n choose k} = n! / (k! (n-k)!)</span> and for <span class="SimpleMath">n &lt; 0</span> and <span class="SimpleMath">k ≥ 0</span> we have <span class="SimpleMath">{n choose k} = (-1)^k {-n+k-1 choose k}</span>.</p>
122
123 <p>If <span class="SimpleMath">n ≥ 0</span> then <span class="SimpleMath">{n choose k}</span> is the number of subsets with <span class="SimpleMath">k</span> elements of a set with <span class="SimpleMath">n</span> elements. Also, <span class="SimpleMath">{n choose k}</span> is the coefficient of <span class="SimpleMath">x^k</span> in the polynomial <span class="SimpleMath">(x + 1)^n</span>, which is the generating function for <span class="SimpleMath">{n choose .}</span>, hence the name.</p>
124
125
126 <div class="example"><pre>
127 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># Knuth calls this the trademark of Binomial:</span>
128 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..4], k-&gt;Binomial( 4, k ) );</span>
129 [ 1, 4, 6, 4, 1 ]
130 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..6], n-&gt;List( [0..6], k-&gt;Binomial( n, k ) ) );;</span>
131 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># the lower triangle is called Pascal's triangle:</span>
132 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintArray( last );</span>
133 [ [ 1, 0, 0, 0, 0, 0, 0 ],
134 [ 1, 1, 0, 0, 0, 0, 0 ],
135 [ 1, 2, 1, 0, 0, 0, 0 ],
136 [ 1, 3, 3, 1, 0, 0, 0 ],
137 [ 1, 4, 6, 4, 1, 0, 0 ],
138 [ 1, 5, 10, 10, 5, 1, 0 ],
139 [ 1, 6, 15, 20, 15, 6, 1 ] ]
140 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Binomial( 50, 10 );</span>
141 10272278170
142 </pre></div>
143
144 <p><code class="func">NrCombinations</code> (<a href="chap16.html#X82A6E98C85714FD0"><span class="RefLink">16.2-3</span></a>) is the generalization of <code class="func">Binomial</code> for multisets. <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>) computes the set of all combinations of a multiset.</p>
145
146 <p><a id="X7DC5667580522BDA" name="X7DC5667580522BDA"></a></p>
147
148 <h5>16.1-3 Bell</h5>
149
150 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Bell</code>( <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
151 <p>returns the <em>Bell number</em> <span class="SimpleMath">B(n)</span>. The Bell numbers are defined by <span class="SimpleMath">B(0) = 1</span> and the recurrence <span class="SimpleMath">B(n+1) = ∑_{k = 0}^n {n choose k} B(k)</span>.</p>
152
153 <p><span class="SimpleMath">B(n)</span> is the number of ways to partition a set of <var class="Arg">n</var> elements into pairwise disjoint nonempty subsets (see <code class="func">PartitionsSet</code> (<a href="chap16.html#X7A13D8DC8204525F"><span class="RefLink">16.2-16</span></a>)). This implies of course that <span class="SimpleMath">B(n) = ∑_{k = 0}^n S_2(n,k)</span> (see <code class="func">Stirling2</code> (<a href="chap16.html#X7C93E14D7BC360F0"><span class="RefLink">16.1-6</span></a>)). <span class="SimpleMath">B(n)/n!</span> is the coefficient of <span class="SimpleMath">x^n</span> in the formal series <span class="SimpleMath">exp( exp(x)-1 )</span>, which is the generating function for <span class="SimpleMath">B(n)</span>.</p>
154
155
156 <div class="example"><pre>
157 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..6], n -&gt; Bell( n ) );</span>
158 [ 1, 1, 2, 5, 15, 52, 203 ]
159 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bell( 14 );</span>
160 190899322
161 </pre></div>
162
163 <p><a id="X792FF6EA786A5C2B" name="X792FF6EA786A5C2B"></a></p>
164
165 <h5>16.1-4 Bernoulli</h5>
166
167 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Bernoulli</code>( <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
168 <p>returns the <var class="Arg">n</var>-th <em>Bernoulli number</em> <span class="SimpleMath">B_n</span>, which is defined by <span class="SimpleMath">B_0 = 1</span> and <span class="SimpleMath">B_n = -∑_{k = 0}^{n-1} {n+1 choose k} B_k/(n+1)</span>.</p>
169
170 <p><span class="SimpleMath">B_n / n!</span> is the coefficient of <span class="SimpleMath">x^n</span> in the power series of <span class="SimpleMath">x / (exp(x)-1)</span>. Except for <span class="SimpleMath">B_1 = -1/2</span> the Bernoulli numbers for odd indices are zero.</p>
171
172
173 <div class="example"><pre>
174 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bernoulli( 4 );</span>
175 -1/30
176 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bernoulli( 10 );</span>
177 5/66
178 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bernoulli( 12 ); # there is no simple pattern in Bernoulli numbers</span>
179 -691/2730
180 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bernoulli( 50 ); # and they grow fairly fast</span>
181 495057205241079648212477525/66
182 </pre></div>
183
184 <p><a id="X85037456785BB33C" name="X85037456785BB33C"></a></p>
185
186 <h5>16.1-5 Stirling1</h5>
187
188 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Stirling1</code>( <var class="Arg">n</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
189 <p>returns the <em>Stirling number of the first kind</em> <span class="SimpleMath">S_1(n,k)</span> of the integers <var class="Arg">n</var> and <var class="Arg">k</var>. Stirling numbers of the first kind are defined by <span class="SimpleMath">S_1(0,0) = 1</span>, <span class="SimpleMath">S_1(n,0) = S_1(0,k) = 0</span> if <span class="SimpleMath">n, k ne 0</span> and the recurrence <span class="SimpleMath">S_1(n,k) = (n-1) S_1(n-1,k) + S_1(n-1,k-1)</span>.</p>
190
191 <p><span class="SimpleMath">S_1(n,k)</span> is the number of permutations of <var class="Arg">n</var> points with <var class="Arg">k</var> cycles. Stirling numbers of the first kind appear as coefficients in the series <span class="SimpleMath">n! {x choose n} = ∑_{k = 0}^n S_1(n,k) x^k</span> which is the generating function for Stirling numbers of the first kind. Note the similarity to <span class="SimpleMath">x^n = ∑_{k = 0}^n S_2(n,k) k! {x choose k}</span> (see <code class="func">Stirling2</code> (<a href="chap16.html#X7C93E14D7BC360F0"><span class="RefLink">16.1-6</span></a>)). Also the definition of <span class="SimpleMath">S_1</span> implies <span class="SimpleMath">S_1(n,k) = S_2(-k,-n)</span> if <span class="SimpleMath">n, k &lt; 0</span>. There are many formulae relating Stirling numbers of the first kind to Stirling numbers of the second kind, Bell numbers, and Binomial coefficients.</p>
192
193
194 <div class="example"><pre>
195 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># Knuth calls this the trademark of S_1:</span>
196 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..4], k -&gt; Stirling1( 4, k ) );</span>
197 [ 0, 6, 11, 6, 1 ]
198 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..6], n-&gt;List( [0..6], k-&gt;Stirling1( n, k ) ) );;</span>
199 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># note the similarity with Pascal's triangle for Binomial numbers</span>
200 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintArray( last );</span>
201 [ [ 1, 0, 0, 0, 0, 0, 0 ],
202 [ 0, 1, 0, 0, 0, 0, 0 ],
203 [ 0, 1, 1, 0, 0, 0, 0 ],
204 [ 0, 2, 3, 1, 0, 0, 0 ],
205 [ 0, 6, 11, 6, 1, 0, 0 ],
206 [ 0, 24, 50, 35, 10, 1, 0 ],
207 [ 0, 120, 274, 225, 85, 15, 1 ] ]
208 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Stirling1(50,10);</span>
209 101623020926367490059043797119309944043405505380503665627365376
210 </pre></div>
211
212 <p><a id="X7C93E14D7BC360F0" name="X7C93E14D7BC360F0"></a></p>
213
214 <h5>16.1-6 Stirling2</h5>
215
216 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Stirling2</code>( <var class="Arg">n</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
217 <p>returns the <em>Stirling number of the second kind</em> <span class="SimpleMath">S_2(n,k)</span> of the integers <var class="Arg">n</var> and <var class="Arg">k</var>. Stirling numbers of the second kind are defined by <span class="SimpleMath">S_2(0,0) = 1</span>, <span class="SimpleMath">S_2(n,0) = S_2(0,k) = 0</span> if <span class="SimpleMath">n, k ne 0</span> and the recurrence <span class="SimpleMath">S_2(n,k) = k S_2(n-1,k) + S_2(n-1,k-1)</span>.</p>
218
219 <p><span class="SimpleMath">S_2(n,k)</span> is the number of ways to partition a set of <var class="Arg">n</var> elements into <var class="Arg">k</var> pairwise disjoint nonempty subsets (see <code class="func">PartitionsSet</code> (<a href="chap16.html#X7A13D8DC8204525F"><span class="RefLink">16.2-16</span></a>)). Stirling numbers of the second kind appear as coefficients in the expansion of <span class="SimpleMath">x^n = ∑_{k = 0}^n S_2(n,k) k! {x choose k}</span>. Note the similarity to <span class="SimpleMath">n! {x choose n} = ∑_{k = 0}^n S_1(n,k) x^k</span> (see <code class="func">Stirling1</code> (<a href="chap16.html#X85037456785BB33C"><span class="RefLink">16.1-5</span></a>)). Also the definition of <span class="SimpleMath">S_2</span> implies <span class="SimpleMath">S_2(n,k) = S_1(-k,-n)</span> if <span class="SimpleMath">n, k &lt; 0</span>. There are many formulae relating Stirling numbers of the second kind to Stirling numbers of the first kind, Bell numbers, and Binomial coefficients.</p>
220
221
222 <div class="example"><pre>
223 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># Knuth calls this the trademark of S_2:</span>
224 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..4], k-&gt;Stirling2( 4, k ) );</span>
225 [ 0, 1, 7, 6, 1 ]
226 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..6], n-&gt;List( [0..6], k-&gt;Stirling2( n, k ) ) );;</span>
227 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># note the similarity with Pascal's triangle for Binomial numbers</span>
228 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintArray( last );</span>
229 [ [ 1, 0, 0, 0, 0, 0, 0 ],
230 [ 0, 1, 0, 0, 0, 0, 0 ],
231 [ 0, 1, 1, 0, 0, 0, 0 ],
232 [ 0, 1, 3, 1, 0, 0, 0 ],
233 [ 0, 1, 7, 6, 1, 0, 0 ],
234 [ 0, 1, 15, 25, 10, 1, 0 ],
235 [ 0, 1, 31, 90, 65, 15, 1 ] ]
236 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Stirling2( 50, 10 );</span>
237 26154716515862881292012777396577993781727011
238 </pre></div>
239
240 <p><a id="X81B4696585C38147" name="X81B4696585C38147"></a></p>
241
242 <h4>16.2 <span class="Heading">Combinations, Arrangements and Tuples</span></h4>
243
244 <p><a id="X8770F16D794C0ADB" name="X8770F16D794C0ADB"></a></p>
245
246 <h5>16.2-1 Combinations</h5>
247
248 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Combinations</code>( <var class="Arg">mset</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
249 <p>returns the set of all combinations of the multiset <var class="Arg">mset</var> (a list of objects which may contain the same object several times) with <var class="Arg">k</var> elements; if <var class="Arg">k</var> is not given it returns all combinations of <var class="Arg">mset</var>.</p>
250
251 <p>A <em>combination</em> of <var class="Arg">mset</var> is an unordered selection without repetitions and is represented by a sorted sublist of <var class="Arg">mset</var>. If <var class="Arg">mset</var> is a proper set, there are <span class="SimpleMath">{|<var class="Arg">mset</var>| choose <var class="Arg">k</var>}</span> (see <code class="func">Binomial</code> (<a href="chap16.html#X7A9AF5F58682819D"><span class="RefLink">16.1-2</span></a>)) combinations with <var class="Arg">k</var> elements, and the set of all combinations is just the <em>power set</em> of <var class="Arg">mset</var>, which contains all <em>subsets</em> of <var class="Arg">mset</var> and has cardinality <span class="SimpleMath">2^{|<var class="Arg">mset</var>|}</span>.</p>
252
253 <p>To loop over combinations of a larger multiset use <code class="func">IteratorOfCombinations</code> (<a href="chap16.html#X78DD5C0D81057540"><span class="RefLink">16.2-2</span></a>) which produces combinations one by one and may save a lot of memory. Another memory efficient representation of the list of all combinations is provided by <code class="func">EnumeratorOfCombinations</code> (<a href="chap16.html#X78DD5C0D81057540"><span class="RefLink">16.2-2</span></a>).</p>
254
255 <p><a id="X78DD5C0D81057540" name="X78DD5C0D81057540"></a></p>
256
257 <h5>16.2-2 <span class="Heading">Iterator and enumerator of combinations</span></h5>
258
259 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IteratorOfCombinations</code>( <var class="Arg">mset</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
260 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EnumeratorOfCombinations</code>( <var class="Arg">mset</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
261 <p><code class="func">IteratorOfCombinations</code> returns an <code class="func">Iterator</code> (<a href="chap30.html#X83ADF8287ED0668E"><span class="RefLink">30.8-1</span></a>) for combinations (see <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>)) of the given multiset <var class="Arg">mset</var>. If a non-negative integer <var class="Arg">k</var> is given as second argument then only the combinations with <var class="Arg">k</var> entries are produced, otherwise all combinations.</p>
262
263 <p><code class="func">EnumeratorOfCombinations</code> returns an <code class="func">Enumerator</code> (<a href="chap30.html#X7EF8910F82B45EC7"><span class="RefLink">30.3-2</span></a>) of the given multiset <var class="Arg">mset</var>. Currently only a variant without second argument <var class="Arg">k</var> is implemented.</p>
264
265 <p>The ordering of combinations from these functions can be different and also different from the list returned by <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>).</p>
266
267
268 <div class="example"><pre>
269 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">m:=[1..15];; Add(m, 15);</span>
270 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrCombinations(m);</span>
271 49152
272 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">i := 0;; for c in Combinations(m) do i := i+1; od;</span>
273 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">i;</span>
274 49152
275 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">cm := EnumeratorOfCombinations(m);;</span>
276 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">cm[1000];</span>
277 [ 1, 2, 3, 6, 7, 8, 9, 10 ]
278 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Position(cm, [1,13,15,15]);</span>
279 36866
280 </pre></div>
281
282 <p><a id="X82A6E98C85714FD0" name="X82A6E98C85714FD0"></a></p>
283
284 <h5>16.2-3 NrCombinations</h5>
285
286 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrCombinations</code>( <var class="Arg">mset</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
287 <p>returns the number of <code class="code">Combinations(<var class="Arg">mset</var>,<var class="Arg">k</var>)</code>.</p>
288
289
290 <div class="example"><pre>
291 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Combinations( [1,2,2,3] );</span>
292 [ [ ], [ 1 ], [ 1, 2 ], [ 1, 2, 2 ], [ 1, 2, 2, 3 ], [ 1, 2, 3 ],
293 [ 1, 3 ], [ 2 ], [ 2, 2 ], [ 2, 2, 3 ], [ 2, 3 ], [ 3 ] ]
294 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># number of different hands in a game of poker:</span>
295 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrCombinations( [1..52], 5 );</span>
296 2598960
297 </pre></div>
298
299 <p>The function <code class="func">Arrangements</code> (<a href="chap16.html#X7837B3357C7566C8"><span class="RefLink">16.2-4</span></a>) computes ordered selections without repetitions, <code class="func">UnorderedTuples</code> (<a href="chap16.html#X81601C6786120DDC"><span class="RefLink">16.2-6</span></a>) computes unordered selections with repetitions, and <code class="func">Tuples</code> (<a href="chap16.html#X86A3CA0F7CC8C320"><span class="RefLink">16.2-8</span></a>) computes ordered selections with repetitions.</p>
300
301 <p><a id="X7837B3357C7566C8" name="X7837B3357C7566C8"></a></p>
302
303 <h5>16.2-4 Arrangements</h5>
304
305 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Arrangements</code>( <var class="Arg">mset</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
306 <p>returns the set of arrangements of the multiset <var class="Arg">mset</var> that contain <var class="Arg">k</var> elements. If <var class="Arg">k</var> is not given it returns all arrangements of <var class="Arg">mset</var>.</p>
307
308 <p>An <em>arrangement</em> of <var class="Arg">mset</var> is an ordered selection without repetitions and is represented by a list that contains only elements from <var class="Arg">mset</var>, but maybe in a different order. If <var class="Arg">mset</var> is a proper set there are <span class="SimpleMath">|mset|! / (|mset|-k)!</span> (see <code class="func">Factorial</code> (<a href="chap16.html#X87665F748594BF29"><span class="RefLink">16.1-1</span></a>)) arrangements with <var class="Arg">k</var> elements.</p>
309
310 <p><a id="X7DE1ABD47D19F140" name="X7DE1ABD47D19F140"></a></p>
311
312 <h5>16.2-5 NrArrangements</h5>
313
314 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrArrangements</code>( <var class="Arg">mset</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
315 <p>returns the number of <code class="code">Arrangements(<var class="Arg">mset</var>,<var class="Arg">k</var>)</code>.</p>
316
317 <p>As an example of arrangements of a multiset, think of the game Scrabble. Suppose you have the six characters of the word <code class="code">"settle"</code> and you have to make a four letter word. Then the possibilities are given by</p>
318
319
320 <div class="example"><pre>
321 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Arrangements( ["s","e","t","t","l","e"], 4 );</span>
322 [ [ "e", "e", "l", "s" ], [ "e", "e", "l", "t" ], [ "e", "e", "s", "l" ],
323 [ "e", "e", "s", "t" ], [ "e", "e", "t", "l" ], [ "e", "e", "t", "s" ],
324 ... 93 more possibilities ...
325 [ "t", "t", "l", "s" ], [ "t", "t", "s", "e" ], [ "t", "t", "s", "l" ] ]
326 </pre></div>
327
328 <p>Can you find the five proper English words, where <code class="code">"lets"</code> does not count? Note that the fact that the list returned by <code class="func">Arrangements</code> (<a href="chap16.html#X7837B3357C7566C8"><span class="RefLink">16.2-4</span></a>) is a proper set means in this example that the possibilities are listed in the same order as they appear in the dictionary.</p>
329
330
331 <div class="example"><pre>
332 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrArrangements( ["s","e","t","t","l","e"] );</span>
333 523
334 </pre></div>
335
336 <p>The function <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>) computes unordered selections without repetitions, <code class="func">UnorderedTuples</code> (<a href="chap16.html#X81601C6786120DDC"><span class="RefLink">16.2-6</span></a>) computes unordered selections with repetitions, and <code class="func">Tuples</code> (<a href="chap16.html#X86A3CA0F7CC8C320"><span class="RefLink">16.2-8</span></a>) computes ordered selections with repetitions.</p>
337
338 <p><a id="X81601C6786120DDC" name="X81601C6786120DDC"></a></p>
339
340 <h5>16.2-6 UnorderedTuples</h5>
341
342 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnorderedTuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
343 <p>returns the set of all unordered tuples of length <var class="Arg">k</var> of the set <var class="Arg">set</var>.</p>
344
345 <p>An <em>unordered tuple</em> of length <var class="Arg">k</var> of <var class="Arg">set</var> is an unordered selection with repetitions of <var class="Arg">set</var> and is represented by a sorted list of length <var class="Arg">k</var> containing elements from <var class="Arg">set</var>. There are <span class="SimpleMath">{|set| + k - 1 choose k}</span> (see <code class="func">Binomial</code> (<a href="chap16.html#X7A9AF5F58682819D"><span class="RefLink">16.1-2</span></a>)) such unordered tuples.</p>
346
347 <p>Note that the fact that <code class="func">UnorderedTuples</code> returns a set implies that the last index runs fastest. That means the first tuple contains the smallest element from <var class="Arg">set</var> <var class="Arg">k</var> times, the second tuple contains the smallest element of <var class="Arg">set</var> at all positions except at the last positions, where it contains the second smallest element from <var class="Arg">set</var> and so on.</p>
348
349 <p><a id="X7959281584C42C52" name="X7959281584C42C52"></a></p>
350
351 <h5>16.2-7 NrUnorderedTuples</h5>
352
353 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrUnorderedTuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
354 <p>returns the number of <code class="code">UnorderedTuples(<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
355
356 <p>As an example for unordered tuples think of a poker-like game played with 5 dice. Then each possible hand corresponds to an unordered five-tuple from the set <span class="SimpleMath">{ 1, 2, ..., 6 }</span>.</p>
357
358
359 <div class="example"><pre>
360 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrUnorderedTuples( [1..6], 5 );</span>
361 252
362 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnorderedTuples( [1..6], 5 );</span>
363 [ [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 3 ], [ 1, 1, 1, 1, 4 ],
364 [ 1, 1, 1, 1, 5 ], [ 1, 1, 1, 1, 6 ], [ 1, 1, 1, 2, 2 ], [ 1, 1, 1, 2, 3 ],
365 ... 100 more tuples ...
366 [ 1, 3, 5, 5, 6 ], [ 1, 3, 5, 6, 6 ], [ 1, 3, 6, 6, 6 ], [ 1, 4, 4, 4, 4 ],
367 ... 100 more tuples ...
368 [ 3, 3, 5, 5, 5 ], [ 3, 3, 5, 5, 6 ], [ 3, 3, 5, 6, 6 ], [ 3, 3, 6, 6, 6 ],
369 ... 32 more tuples ...
370 [ 5, 5, 5, 6, 6 ], [ 5, 5, 6, 6, 6 ], [ 5, 6, 6, 6, 6 ], [ 6, 6, 6, 6, 6 ] ]
371 </pre></div>
372
373 <p>The function <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>) computes unordered selections without repetitions, <code class="func">Arrangements</code> (<a href="chap16.html#X7837B3357C7566C8"><span class="RefLink">16.2-4</span></a>) computes ordered selections without repetitions, and <code class="func">Tuples</code> (<a href="chap16.html#X86A3CA0F7CC8C320"><span class="RefLink">16.2-8</span></a>) computes ordered selections with repetitions.</p>
374
375 <p><a id="X86A3CA0F7CC8C320" name="X86A3CA0F7CC8C320"></a></p>
376
377 <h5>16.2-8 Tuples</h5>
378
379 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Tuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
380 <p>returns the set of all ordered tuples of length <var class="Arg">k</var> of the set <var class="Arg">set</var>.</p>
381
382 <p>An <em>ordered tuple</em> of length <var class="Arg">k</var> of <var class="Arg">set</var> is an ordered selection with repetition and is represented by a list of length <var class="Arg">k</var> containing elements of <var class="Arg">set</var>. There are <span class="SimpleMath">|<var class="Arg">set</var>|^<var class="Arg">k</var></span> such ordered tuples.</p>
383
384 <p>Note that the fact that <code class="func">Tuples</code> returns a set implies that the last index runs fastest. That means the first tuple contains the smallest element from <var class="Arg">set</var> <var class="Arg">k</var> times, the second tuple contains the smallest element of <var class="Arg">set</var> at all positions except at the last positions, where it contains the second smallest element from <var class="Arg">set</var> and so on.</p>
385
386 <p><a id="X7BA135297E8DA819" name="X7BA135297E8DA819"></a></p>
387
388 <h5>16.2-9 EnumeratorOfTuples</h5>
389
390 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EnumeratorOfTuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
391 <p>This function is referred to as an example of enumerators that are defined by functions but are not constructed from a domain. The result is equal to that of <code class="code">Tuples( <var class="Arg">set</var>, <var class="Arg">k</var> )</code>. However, the entries are not stored physically in the list but are created/identified on demand.</p>
392
393 <p><a id="X86416A31807B0086" name="X86416A31807B0086"></a></p>
394
395 <h5>16.2-10 IteratorOfTuples</h5>
396
397 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IteratorOfTuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
398 <p>For a set <var class="Arg">set</var> and a positive integer <var class="Arg">k</var>, <code class="func">IteratorOfTuples</code> returns an iterator (see <a href="chap30.html#X85A3F00985453F95"><span class="RefLink">30.8</span></a>) of the set of all ordered tuples (see <code class="func">Tuples</code> (<a href="chap16.html#X86A3CA0F7CC8C320"><span class="RefLink">16.2-8</span></a>)) of length <var class="Arg">k</var> of the set <var class="Arg">set</var>. The tuples are returned in lexicographic order.</p>
399
400 <p><a id="X85E18A9A87FD4CA2" name="X85E18A9A87FD4CA2"></a></p>
401
402 <h5>16.2-11 NrTuples</h5>
403
404 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrTuples</code>( <var class="Arg">set</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
405 <p>returns the number of <code class="code">Tuples(<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
406
407
408 <div class="example"><pre>
409 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Tuples( [1,2,3], 2 );</span>
410 [ [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 1 ], [ 2, 2 ], [ 2, 3 ],
411 [ 3, 1 ], [ 3, 2 ], [ 3, 3 ] ]
412 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrTuples( [1..10], 5 );</span>
413 100000
414 </pre></div>
415
416 <p><code class="code">Tuples(<var class="Arg">set</var>,<var class="Arg">k</var>)</code> can also be viewed as the <var class="Arg">k</var>-fold cartesian product of <var class="Arg">set</var> (see <code class="func">Cartesian</code> (<a href="chap21.html#X7E1593B979BDF2CD"><span class="RefLink">21.20-15</span></a>)).</p>
417
418 <p>The function <code class="func">Combinations</code> (<a href="chap16.html#X8770F16D794C0ADB"><span class="RefLink">16.2-1</span></a>) computes unordered selections without repetitions, <code class="func">Arrangements</code> (<a href="chap16.html#X7837B3357C7566C8"><span class="RefLink">16.2-4</span></a>) computes ordered selections without repetitions, and finally the function <code class="func">UnorderedTuples</code> (<a href="chap16.html#X81601C6786120DDC"><span class="RefLink">16.2-6</span></a>) computes unordered selections with repetitions.</p>
419
420 <p><a id="X7B0143FB83F359B7" name="X7B0143FB83F359B7"></a></p>
421
422 <h5>16.2-12 PermutationsList</h5>
423
424 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PermutationsList</code>( <var class="Arg">mset</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
425 <p><code class="func">PermutationsList</code> returns the set of permutations of the multiset <var class="Arg">mset</var>.</p>
426
427 <p>A <em>permutation</em> is represented by a list that contains exactly the same elements as <var class="Arg">mset</var>, but possibly in different order. If <var class="Arg">mset</var> is a proper set there are <span class="SimpleMath">|<var class="Arg">mset</var>| !</span> (see <code class="func">Factorial</code> (<a href="chap16.html#X87665F748594BF29"><span class="RefLink">16.1-1</span></a>)) such permutations. Otherwise if the first elements appears <span class="SimpleMath">k_1</span> times, the second element appears <span class="SimpleMath">k_2</span> times and so on, the number of permutations is <span class="SimpleMath">|<var class="Arg">mset</var>| ! / (k_1! k_2! ...)</span>, which is sometimes called multinomial coefficient.</p>
428
429 <p><a id="X8629A2908050EB3A" name="X8629A2908050EB3A"></a></p>
430
431 <h5>16.2-13 NrPermutationsList</h5>
432
433 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrPermutationsList</code>( <var class="Arg">mset</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
434 <p>returns the number of <code class="code">PermutationsList(<var class="Arg">mset</var>)</code>.</p>
435
436
437 <div class="example"><pre>
438 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PermutationsList( [1,2,3] );</span>
439 [ [ 1, 2, 3 ], [ 1, 3, 2 ], [ 2, 1, 3 ], [ 2, 3, 1 ], [ 3, 1, 2 ],
440 [ 3, 2, 1 ] ]
441 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PermutationsList( [1,1,2,2] );</span>
442 [ [ 1, 1, 2, 2 ], [ 1, 2, 1, 2 ], [ 1, 2, 2, 1 ], [ 2, 1, 1, 2 ],
443 [ 2, 1, 2, 1 ], [ 2, 2, 1, 1 ] ]
444 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrPermutationsList( [1,2,2,3,3,3,4,4,4,4] );</span>
445 12600
446 </pre></div>
447
448 <p>The function <code class="func">Arrangements</code> (<a href="chap16.html#X7837B3357C7566C8"><span class="RefLink">16.2-4</span></a>) is the generalization of <code class="func">PermutationsList</code> (<a href="chap16.html#X7B0143FB83F359B7"><span class="RefLink">16.2-12</span></a>) that allows you to specify the size of the permutations. <code class="func">Derangements</code> (<a href="chap16.html#X79C159507B2BF1C9"><span class="RefLink">16.2-14</span></a>) computes permutations that have no fixed points.</p>
449
450 <p><a id="X79C159507B2BF1C9" name="X79C159507B2BF1C9"></a></p>
451
452 <h5>16.2-14 Derangements</h5>
453
454 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Derangements</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
455 <p>returns the set of all derangements of the list <var class="Arg">list</var>.</p>
456
457 <p>A <em>derangement</em> is a fixpointfree permutation of <var class="Arg">list</var> and is represented by a list that contains exactly the same elements as <var class="Arg">list</var>, but in such an order that the derangement has at no position the same element as <var class="Arg">list</var>. If the list <var class="Arg">list</var> contains no element twice there are exactly <span class="SimpleMath">|<var class="Arg">list</var>|! (1/2! - 1/3! + 1/4! - ⋯ + (-1)^n / n!)</span> derangements.</p>
458
459 <p>Note that the ratio <code class="code">NrPermutationsList( [ 1 .. n ] ) / NrDerangements( [ 1 .. n ] )</code>, which is <span class="SimpleMath">n! / (n! (1/2! - 1/3! + 1/4! - ⋯ + (-1)^n / n!))</span> is an approximation for the base of the natural logarithm <span class="SimpleMath">e = 2.7182818285...</span>, which is correct to about <span class="SimpleMath">n</span> digits.</p>
460
461 <p><a id="X7C1741B181A9AB9C" name="X7C1741B181A9AB9C"></a></p>
462
463 <h5>16.2-15 NrDerangements</h5>
464
465 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrDerangements</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
466 <p>returns the number of <code class="code">Derangements(<var class="Arg">list</var>)</code>.</p>
467
468 <p>As an example of derangements suppose that you have to send four different letters to four different people. Then a derangement corresponds to a way to send those letters such that no letter reaches the intended person.</p>
469
470
471 <div class="example"><pre>
472 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Derangements( [1,2,3,4] );</span>
473 [ [ 2, 1, 4, 3 ], [ 2, 3, 4, 1 ], [ 2, 4, 1, 3 ], [ 3, 1, 4, 2 ],
474 [ 3, 4, 1, 2 ], [ 3, 4, 2, 1 ], [ 4, 1, 2, 3 ], [ 4, 3, 1, 2 ],
475 [ 4, 3, 2, 1 ] ]
476 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrDerangements( [1..10] );</span>
477 1334961
478 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Int( 10^7*NrPermutationsList([1..10])/last );</span>
479 27182816
480 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Derangements( [1,1,2,2,3,3] );</span>
481 [ [ 2, 2, 3, 3, 1, 1 ], [ 2, 3, 1, 3, 1, 2 ], [ 2, 3, 1, 3, 2, 1 ],
482 [ 2, 3, 3, 1, 1, 2 ], [ 2, 3, 3, 1, 2, 1 ], [ 3, 2, 1, 3, 1, 2 ],
483 [ 3, 2, 1, 3, 2, 1 ], [ 3, 2, 3, 1, 1, 2 ], [ 3, 2, 3, 1, 2, 1 ],
484 [ 3, 3, 1, 1, 2, 2 ] ]
485 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrDerangements( [1,2,2,3,3,3,4,4,4,4] );</span>
486 338
487 </pre></div>
488
489 <p>The function <code class="func">PermutationsList</code> (<a href="chap16.html#X7B0143FB83F359B7"><span class="RefLink">16.2-12</span></a>) computes all permutations of a list.</p>
490
491 <p><a id="X7A13D8DC8204525F" name="X7A13D8DC8204525F"></a></p>
492
493 <h5>16.2-16 PartitionsSet</h5>
494
495 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartitionsSet</code>( <var class="Arg">set</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
496 <p>returns the set of all unordered partitions of the set <var class="Arg">set</var> into <var class="Arg">k</var> pairwise disjoint nonempty sets. If <var class="Arg">k</var> is not given it returns all unordered partitions of <var class="Arg">set</var> for all <var class="Arg">k</var>.</p>
497
498 <p>An <em>unordered partition</em> of <var class="Arg">set</var> is a set of pairwise disjoint nonempty sets with union <var class="Arg">set</var> and is represented by a sorted list of such sets. There are <span class="SimpleMath">B( |set| )</span> (see <code class="func">Bell</code> (<a href="chap16.html#X7DC5667580522BDA"><span class="RefLink">16.1-3</span></a>)) partitions of the set <var class="Arg">set</var> and <span class="SimpleMath">S_2( |set|, k )</span> (see <code class="func">Stirling2</code> (<a href="chap16.html#X7C93E14D7BC360F0"><span class="RefLink">16.1-6</span></a>)) partitions with <var class="Arg">k</var> elements.</p>
499
500 <p><a id="X7BCD7FC2876386F1" name="X7BCD7FC2876386F1"></a></p>
501
502 <h5>16.2-17 NrPartitionsSet</h5>
503
504 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrPartitionsSet</code>( <var class="Arg">set</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
505 <p>returns the number of <code class="code">PartitionsSet(<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
506
507
508 <div class="example"><pre>
509 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionsSet( [1,2,3] );</span>
510 [ [ [ 1 ], [ 2 ], [ 3 ] ], [ [ 1 ], [ 2, 3 ] ], [ [ 1, 2 ], [ 3 ] ],
511 [ [ 1, 2, 3 ] ], [ [ 1, 3 ], [ 2 ] ] ]
512 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionsSet( [1,2,3,4], 2 );</span>
513 [ [ [ 1 ], [ 2, 3, 4 ] ], [ [ 1, 2 ], [ 3, 4 ] ],
514 [ [ 1, 2, 3 ], [ 4 ] ], [ [ 1, 2, 4 ], [ 3 ] ],
515 [ [ 1, 3 ], [ 2, 4 ] ], [ [ 1, 3, 4 ], [ 2 ] ],
516 [ [ 1, 4 ], [ 2, 3 ] ] ]
517 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrPartitionsSet( [1..6] );</span>
518 203
519 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrPartitionsSet( [1..10], 3 );</span>
520 9330
521 </pre></div>
522
523 <p>Note that <code class="func">PartitionsSet</code> (<a href="chap16.html#X7A13D8DC8204525F"><span class="RefLink">16.2-16</span></a>) does currently not support multisets and that there is currently no ordered counterpart.</p>
524
525 <p><a id="X84A6D15F8107008B" name="X84A6D15F8107008B"></a></p>
526
527 <h5>16.2-18 Partitions</h5>
528
529 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Partitions</code>( <var class="Arg">n</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
530 <p>returns the set of all (unordered) partitions of the positive integer <var class="Arg">n</var> into sums with <var class="Arg">k</var> summands. If <var class="Arg">k</var> is not given it returns all unordered partitions of <var class="Arg">n</var> for all <var class="Arg">k</var>.</p>
531
532 <p>An <em>unordered partition</em> is an unordered sum <span class="SimpleMath">n = p_1 + p_2 + ⋯ + p_k</span> of positive integers and is represented by the list <span class="SimpleMath">p = [ p_1, p_2, ..., p_k ]</span>, in nonincreasing order, i.e., <span class="SimpleMath">p_1 ≥ p_2 ≥ ... ≥ p_k</span>. We write <span class="SimpleMath">p ⊢ n</span>. There are approximately <span class="SimpleMath">exp(π sqrt{2/3 n}) / (4 sqrt{3} n)</span> such partitions, use <code class="func">NrPartitions</code> (<a href="chap16.html#X86933C4F795C4EBD"><span class="RefLink">16.2-21</span></a>) to compute the precise number.</p>
533
534 <p>If you want to loop over all partitions of some larger <var class="Arg">n</var> use the more memory efficient <code class="func">IteratorOfPartitions</code> (<a href="chap16.html#X8793AEBD7E529E1D"><span class="RefLink">16.2-19</span></a>).</p>
535
536 <p>It is possible to associate with every partition of the integer <var class="Arg">n</var> a conjugacy class of permutations in the symmetric group on <var class="Arg">n</var> points and vice versa. Therefore <span class="SimpleMath">p(n) :=</span><code class="code">NrPartitions</code><span class="SimpleMath">(n)</span> is the number of conjugacy classes of the symmetric group on <var class="Arg">n</var> points.</p>
537
538 <p>Ramanujan found the identities <span class="SimpleMath">p(5i+4) = 0</span> mod 5, <span class="SimpleMath">p(7i+5) = 0</span> mod 7 and <span class="SimpleMath">p(11i+6) = 0</span> mod 11 and many other fascinating things about the number of partitions.</p>
539
540 <p><a id="X8793AEBD7E529E1D" name="X8793AEBD7E529E1D"></a></p>
541
542 <h5>16.2-19 IteratorOfPartitions</h5>
543
544 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IteratorOfPartitions</code>( <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
545 <p>For a positive integer <var class="Arg">n</var>, <code class="func">IteratorOfPartitions</code> returns an iterator (see <a href="chap30.html#X85A3F00985453F95"><span class="RefLink">30.8</span></a>) of the set of partitions of <var class="Arg">n</var> (see <code class="func">Partitions</code> (<a href="chap16.html#X84A6D15F8107008B"><span class="RefLink">16.2-18</span></a>)). The partitions of <var class="Arg">n</var> are returned in lexicographic order.</p>
546
547 <p><a id="X7ECDBC227BFB2EC6" name="X7ECDBC227BFB2EC6"></a></p>
548
549 <h5>16.2-20 <span class="Heading">Iterator and enumerator of unordered set partitions</span></h5>
550
551 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IteratorOfPartitionsSet</code>( <var class="Arg">set</var>[, <var class="Arg">k</var>[, <var class="Arg">flag</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
552 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EnumeratorOfPartitionsSet</code>( <var class="Arg">set</var>[, <var class="Arg">k</var>[, <var class="Arg">flag</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
553 <p><code class="func">IteratorOfPartitionsSet</code> returns an iterator (see <a href="chap30.html#X85A3F00985453F95"><span class="RefLink">30.8</span></a>) for all unordered partitions of the set <var class="Arg">set</var> into pairwise disjoint nonempty sets (see <code class="func">PartitionsSet</code> (<a href="chap16.html#X7A13D8DC8204525F"><span class="RefLink">16.2-16</span></a>)). If <var class="Arg">k</var> given and <var class="Arg">flag</var> is omitted or equal to <code class="keyw">false</code>, then only partitions of size <var class="Arg">k</var> are computed. If <var class="Arg">k</var> is given and <var class="Arg">flag</var> is equal to <code class="keyw">true</code>, then only partitions of size at most <var class="Arg">k</var> are computed.</p>
554
555 <p><code class="func">EnumeratorOfPartitionsSet</code> returns an enumerator (see <code class="func">Enumerator</code> (<a href="chap30.html#X7EF8910F82B45EC7"><span class="RefLink">30.3-2</span></a>)) for all unordered partitions of the set <var class="Arg">set</var>. The arguments <var class="Arg">k</var> and <var class="Arg">flag</var> function in the same manner as for the iterator.</p>
556
557 <p>The ordering of the partitions from these functions can be different and also different from the list returned by <code class="func">PartitionsSet</code> (<a href="chap16.html#X7A13D8DC8204525F"><span class="RefLink">16.2-16</span></a>).</p>
558
559
560 <div class="example"><pre>
561 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">m:=[1..9];;</span>
562 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Bell(9);</span>
563 21147
564 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Length(PartitionsSet(m));</span>
565 21147
566 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">cm := EnumeratorOfPartitionsSet(m);;</span>
567 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">cm[1000];</span>
568 [ [ 1, 2, 4, 9 ], [ 3, 6, 8 ], [ 5, 7 ] ]
569 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Position(cm, last);</span>
570 1000
571 </pre></div>
572
573 <p><a id="X86933C4F795C4EBD" name="X86933C4F795C4EBD"></a></p>
574
575 <h5>16.2-21 NrPartitions</h5>
576
577 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrPartitions</code>( <var class="Arg">n</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
578 <p>returns the number of <code class="code">Partitions(<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
579
580
581 <div class="example"><pre>
582 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Partitions( 7 );</span>
583 [ [ 1, 1, 1, 1, 1, 1, 1 ], [ 2, 1, 1, 1, 1, 1 ], [ 2, 2, 1, 1, 1 ],
584 [ 2, 2, 2, 1 ], [ 3, 1, 1, 1, 1 ], [ 3, 2, 1, 1 ], [ 3, 2, 2 ],
585 [ 3, 3, 1 ], [ 4, 1, 1, 1 ], [ 4, 2, 1 ], [ 4, 3 ], [ 5, 1, 1 ],
586 [ 5, 2 ], [ 6, 1 ], [ 7 ] ]
587 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Partitions( 8, 3 );</span>
588 [ [ 3, 3, 2 ], [ 4, 2, 2 ], [ 4, 3, 1 ], [ 5, 2, 1 ], [ 6, 1, 1 ] ]
589 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrPartitions( 7 );</span>
590 15
591 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrPartitions( 100 );</span>
592 190569292
593 </pre></div>
594
595 <p>The function <code class="func">OrderedPartitions</code> (<a href="chap16.html#X820DF201871F2723"><span class="RefLink">16.2-22</span></a>) is the ordered counterpart of <code class="func">Partitions</code> (<a href="chap16.html#X84A6D15F8107008B"><span class="RefLink">16.2-18</span></a>).</p>
596
597 <p><a id="X820DF201871F2723" name="X820DF201871F2723"></a></p>
598
599 <h5>16.2-22 OrderedPartitions</h5>
600
601 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; OrderedPartitions</code>( <var class="Arg">n</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
602 <p>returns the set of all ordered partitions of the positive integer <var class="Arg">n</var> into sums with <var class="Arg">k</var> summands. If <var class="Arg">k</var> is not given it returns all ordered partitions of <var class="Arg">set</var> for all <var class="Arg">k</var>.</p>
603
604 <p>An <em>ordered partition</em> is an ordered sum <span class="SimpleMath">n = p_1 + p_2 + ... + p_k</span> of positive integers and is represented by the list <span class="SimpleMath">[ p_1, p_2, ..., p_k ]</span>. There are totally <span class="SimpleMath">2^{n-1}</span> ordered partitions and <span class="SimpleMath">{n-1 choose k-1}</span> (see <code class="func">Binomial</code> (<a href="chap16.html#X7A9AF5F58682819D"><span class="RefLink">16.1-2</span></a>)) ordered partitions with <var class="Arg">k</var> summands.</p>
605
606 <p>Do not call <code class="func">OrderedPartitions</code> with an <var class="Arg">n</var> much larger than <span class="SimpleMath">15</span>, the list will simply become too large.</p>
607
608 <p><a id="X80BB9F4982CA1E8B" name="X80BB9F4982CA1E8B"></a></p>
609
610 <h5>16.2-23 NrOrderedPartitions</h5>
611
612 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrOrderedPartitions</code>( <var class="Arg">n</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
613 <p>returns the number of <code class="code">OrderedPartitions(<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
614
615
616 <div class="example"><pre>
617 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">OrderedPartitions( 5 );</span>
618 [ [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 3 ],
619 [ 1, 2, 1, 1 ], [ 1, 2, 2 ], [ 1, 3, 1 ], [ 1, 4 ], [ 2, 1, 1, 1 ],
620 [ 2, 1, 2 ], [ 2, 2, 1 ], [ 2, 3 ], [ 3, 1, 1 ], [ 3, 2 ],
621 [ 4, 1 ], [ 5 ] ]
622 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">OrderedPartitions( 6, 3 );</span>
623 [ [ 1, 1, 4 ], [ 1, 2, 3 ], [ 1, 3, 2 ], [ 1, 4, 1 ], [ 2, 1, 3 ],
624 [ 2, 2, 2 ], [ 2, 3, 1 ], [ 3, 1, 2 ], [ 3, 2, 1 ], [ 4, 1, 1 ] ]
625 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrOrderedPartitions(20);</span>
626 524288
627 </pre></div>
628
629 <p>The function <code class="func">Partitions</code> (<a href="chap16.html#X84A6D15F8107008B"><span class="RefLink">16.2-18</span></a>) is the unordered counterpart of <code class="func">OrderedPartitions</code> (<a href="chap16.html#X820DF201871F2723"><span class="RefLink">16.2-22</span></a>).</p>
630
631 <p><a id="X8009520C82942461" name="X8009520C82942461"></a></p>
632
633 <h5>16.2-24 PartitionsGreatestLE</h5>
634
635 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartitionsGreatestLE</code>( <var class="Arg">n</var>, <var class="Arg">m</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
636 <p>returns the set of all (unordered) partitions of the integer <var class="Arg">n</var> having parts less or equal to the integer <var class="Arg">m</var>. For <span class="SimpleMath"><var class="Arg">n</var> = 0</span> and <span class="SimpleMath"><var class="Arg">m</var> ≥ 0</span>, this returns the empty partition <code class="code">[[]]</code>. Negative arguments yield the empty list.</p>
637
638
639 <div class="example"><pre>
640 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionsGreatestLE( 6, 3 );</span>
641 [ [ 1, 1, 1, 1, 1, 1 ], [ 2, 1, 1, 1, 1 ], [ 2, 2, 1, 1 ], [ 2, 2, 2 ],
642 [ 3, 1, 1, 1 ], [ 3, 2, 1 ], [ 3, 3 ] ]
643 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [ 0 .. 3 ], m -&gt; PartitionsGreatestLE( 0, m ) );</span>
644 [ [ [ ] ], [ [ ] ], [ [ ] ], [ [ ] ] ]
645 </pre></div>
646
647 <p><a id="X7CB8D4FF8592A9BB" name="X7CB8D4FF8592A9BB"></a></p>
648
649 <h5>16.2-25 PartitionsGreatestEQ</h5>
650
651 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartitionsGreatestEQ</code>( <var class="Arg">n</var>, <var class="Arg">m</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
652 <p>returns the set of all (unordered) partitions of the integer <var class="Arg">n</var> having greatest part equal to the integer <var class="Arg">m</var>. Since partitions use positive parts, this returns the empty list if <span class="SimpleMath"><var class="Arg">n</var> ≤ 0</span> or <span class="SimpleMath"><var class="Arg">m</var> ≤ 0</span>.</p>
653
654
655 <div class="example"><pre>
656 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionsGreatestEQ( 6, 3 );</span>
657 [ [ 3, 1, 1, 1 ], [ 3, 2, 1 ], [ 3, 3 ] ]
658 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionsGreatestEQ( 0, 1 );</span>
659 [ ]
660 </pre></div>
661
662 <p><a id="X7A70D4F3809494E7" name="X7A70D4F3809494E7"></a></p>
663
664 <h5>16.2-26 RestrictedPartitions</h5>
665
666 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RestrictedPartitions</code>( <var class="Arg">n</var>, <var class="Arg">set</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
667 <p>In the first form <code class="func">RestrictedPartitions</code> returns the set of all restricted partitions of the positive integer <var class="Arg">n</var> into sums with <var class="Arg">k</var> summands with the summands of the partition coming from the set <var class="Arg">set</var>. If <var class="Arg">k</var> is not given all restricted partitions for all <var class="Arg">k</var> are returned.</p>
668
669 <p>A <em>restricted partition</em> is like an ordinary partition (see <code class="func">Partitions</code> (<a href="chap16.html#X84A6D15F8107008B"><span class="RefLink">16.2-18</span></a>)) an unordered sum <span class="SimpleMath">n = p_1 + p_2 + ... + p_k</span> of positive integers and is represented by the list <span class="SimpleMath">p = [ p_1, p_2, ..., p_k ]</span>, in nonincreasing order. The difference is that here the <span class="SimpleMath">p_i</span> must be elements from the set <var class="Arg">set</var>, while for ordinary partitions they may be elements from <code class="code">[ 1 .. n ]</code>.</p>
670
671 <p><a id="X800B43838742FBF4" name="X800B43838742FBF4"></a></p>
672
673 <h5>16.2-27 NrRestrictedPartitions</h5>
674
675 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrRestrictedPartitions</code>( <var class="Arg">n</var>, <var class="Arg">set</var>[, <var class="Arg">k</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
676 <p>returns the number of <code class="code">RestrictedPartitions(<var class="Arg">n</var>,<var class="Arg">set</var>,<var class="Arg">k</var>)</code>.</p>
677
678
679 <div class="example"><pre>
680 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RestrictedPartitions( 8, [1,3,5,7] );</span>
681 [ [ 1, 1, 1, 1, 1, 1, 1, 1 ], [ 3, 1, 1, 1, 1, 1 ], [ 3, 3, 1, 1 ],
682 [ 5, 1, 1, 1 ], [ 5, 3 ], [ 7, 1 ] ]
683 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrRestrictedPartitions(50,[1,2,5,10,20,50]);</span>
684 451
685 </pre></div>
686
687 <p>The last example tells us that there are 451 ways to return 50 pence change using 1, 2, 5, 10, 20 and 50 pence coins.</p>
688
689 <p><a id="X7F4EDCCA780B469D" name="X7F4EDCCA780B469D"></a></p>
690
691 <h5>16.2-28 SignPartition</h5>
692
693 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SignPartition</code>( <var class="Arg">pi</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
694 <p>returns the sign of a permutation with cycle structure <var class="Arg">pi</var>.</p>
695
696 <p>This function actually describes a homomorphism from the symmetric group <span class="SimpleMath">S_n</span> into the cyclic group of order 2, whose kernel is exactly the alternating group <span class="SimpleMath">A_n</span> (see <code class="func">SignPerm</code> (<a href="chap42.html#X7BE5011B7C0DB704"><span class="RefLink">42.4-1</span></a>)). Partitions of sign 1 are called <em>even</em> partitions while partitions of sign <span class="SimpleMath">-1</span> are called <em>odd</em>.</p>
697
698
699 <div class="example"><pre>
700 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SignPartition([6,5,4,3,2,1]);</span>
701 -1
702 </pre></div>
703
704 <p><a id="X7DB9BEB6856EC03D" name="X7DB9BEB6856EC03D"></a></p>
705
706 <h5>16.2-29 AssociatedPartition</h5>
707
708 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AssociatedPartition</code>( <var class="Arg">pi</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
709 <p><code class="func">AssociatedPartition</code> returns the associated partition of the partition <var class="Arg">pi</var> which is obtained by transposing the corresponding Young diagram.</p>
710
711
712 <div class="example"><pre>
713 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AssociatedPartition([4,2,1]);</span>
714 [ 3, 2, 1, 1 ]
715 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AssociatedPartition([6]);</span>
716 [ 1, 1, 1, 1, 1, 1 ]
717 </pre></div>
718
719 <p><a id="X7A95D8A6820363A8" name="X7A95D8A6820363A8"></a></p>
720
721 <h5>16.2-30 PowerPartition</h5>
722
723 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PowerPartition</code>( <var class="Arg">pi</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
724 <p><code class="func">PowerPartition</code> returns the partition corresponding to the <var class="Arg">k</var>-th power of a permutation with cycle structure <var class="Arg">pi</var>.</p>
725
726 <p>Each part <span class="SimpleMath">l</span> of <var class="Arg">pi</var> is replaced by <span class="SimpleMath">d = gcd(l, k)</span> parts <span class="SimpleMath">l/d</span>. So if <var class="Arg">pi</var> is a partition of <span class="SimpleMath">n</span> then <span class="SimpleMath"><var class="Arg">pi</var>^<var class="Arg">k</var></span> also is a partition of <span class="SimpleMath">n</span>. <code class="func">PowerPartition</code> describes the power map of symmetric groups.</p>
727
728
729 <div class="example"><pre>
730 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PowerPartition([6,5,4,3,2,1], 3);</span>
731 [ 5, 4, 2, 2, 2, 2, 1, 1, 1, 1 ]
732 </pre></div>
733
734 <p><a id="X877D997B7F66A119" name="X877D997B7F66A119"></a></p>
735
736 <h5>16.2-31 PartitionTuples</h5>
737
738 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartitionTuples</code>( <var class="Arg">n</var>, <var class="Arg">r</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
739 <p><code class="func">PartitionTuples</code> returns the list of all <var class="Arg">r</var>-tuples of partitions which together form a partition of <var class="Arg">n</var>.</p>
740
741 <p><var class="Arg">r</var>-tuples of partitions describe the classes and the characters of wreath products of groups with <var class="Arg">r</var> conjugacy classes with the symmetric group on <var class="Arg">n</var> points, see <code class="func">CharacterTableWreathSymmetric</code> (<a href="chap71.html#X79B75C8582426BC5"><span class="RefLink">71.20-6</span></a>) and <code class="func">CharacterValueWreathSymmetric</code> (<a href="chap71.html#X83E71B1F7FA70134"><span class="RefLink">71.20-7</span></a>).</p>
742
743 <p><a id="X7F44AD098561DE32" name="X7F44AD098561DE32"></a></p>
744
745 <h5>16.2-32 NrPartitionTuples</h5>
746
747 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrPartitionTuples</code>( <var class="Arg">n</var>, <var class="Arg">r</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
748 <p>returns the number of <code class="code">PartitionTuples( <var class="Arg">n</var>, <var class="Arg">r</var> )</code>.</p>
749
750
751 <div class="example"><pre>
752 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PartitionTuples(3, 2);</span>
753 [ [ [ 1, 1, 1 ], [ ] ], [ [ 1, 1 ], [ 1 ] ], [ [ 1 ], [ 1, 1 ] ],
754 [ [ ], [ 1, 1, 1 ] ], [ [ 2, 1 ], [ ] ], [ [ 1 ], [ 2 ] ],
755 [ [ 2 ], [ 1 ] ], [ [ ], [ 2, 1 ] ], [ [ 3 ], [ ] ],
756 [ [ ], [ 3 ] ] ]
757 </pre></div>
758
759 <p><a id="X8796C1D783ED9CB4" name="X8796C1D783ED9CB4"></a></p>
760
761 <h5>16.2-33 BetaSet</h5>
762
763 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BetaSet</code>( <var class="Arg">alpha</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
764 <p>For a list <var class="Arg">alpha</var> that describes a partition of a nonnegative integer (see <code class="func">Partitions</code> (<a href="chap16.html#X84A6D15F8107008B"><span class="RefLink">16.2-18</span></a>)), <code class="func">BetaSet</code> returns the list of integers obtained by reversing the order of <var class="Arg">alpha</var> and then adding the sequence <code class="code">[ 0, 1, 2, ... ]</code> of the same length, cf. <a href="chapBib.html#biBJK81">[JK81, Section 2.7]</a>.</p>
765
766
767 <div class="example"><pre>
768 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">BetaSet( [ 4, 2, 1 ] );</span>
769 [ 1, 3, 6 ]
770 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">BetaSet( [] );</span>
771 [ ]
772 </pre></div>
773
774 <p><a id="X83DC50B67D74E674" name="X83DC50B67D74E674"></a></p>
775
776 <h4>16.3 <span class="Heading">Fibonacci and Lucas Sequences</span></h4>
777
778 <p><a id="X85AE1D70803A886C" name="X85AE1D70803A886C"></a></p>
779
780 <h5>16.3-1 Fibonacci</h5>
781
782 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Fibonacci</code>( <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
783 <p>returns the <var class="Arg">n</var>th number of the <em>Fibonacci sequence</em>. The Fibonacci sequence <span class="SimpleMath">F_n</span> is defined by the initial conditions <span class="SimpleMath">F_1 = F_2 = 1</span> and the recurrence relation <span class="SimpleMath">F_{n+2} = F_{n+1} + F_n</span>. For negative <span class="SimpleMath">n</span> we define <span class="SimpleMath">F_n = (-1)^{n+1} F_{-n}</span>, which is consistent with the recurrence relation.</p>
784
785 <p>Using generating functions one can prove that <span class="SimpleMath">F_n = ϕ^n - 1/ϕ^n</span>, where <span class="SimpleMath">ϕ</span> is <span class="SimpleMath">(sqrt{5} + 1)/2</span>, i.e., one root of <span class="SimpleMath">x^2 - x - 1 = 0</span>. Fibonacci numbers have the property <span class="SimpleMath">gcd( F_m, F_n ) = F_{gcd(m,n)}</span>. But a pair of Fibonacci numbers requires more division steps in Euclid's algorithm (see <code class="func">Gcd</code> (<a href="chap56.html#X7DE207718456F98F"><span class="RefLink">56.7-1</span></a>)) than any other pair of integers of the same size. <code class="code">Fibonacci(<var class="Arg">k</var>)</code> is the special case <code class="code">Lucas(1,-1,<var class="Arg">k</var>)[1]</code> (see <code class="func">Lucas</code> (<a href="chap16.html#X7830A03181D67192"><span class="RefLink">16.3-2</span></a>)).</p>
786
787
788 <div class="example"><pre>
789 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Fibonacci( 10 );</span>
790 55
791 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Fibonacci( 35 );</span>
792 9227465
793 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Fibonacci( -10 );</span>
794 -55
795 </pre></div>
796
797 <p><a id="X7830A03181D67192" name="X7830A03181D67192"></a></p>
798
799 <h5>16.3-2 Lucas</h5>
800
801 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Lucas</code>( <var class="Arg">P</var>, <var class="Arg">Q</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
802 <p>returns the <var class="Arg">k</var>-th values of the <em>Lucas sequence</em> with parameters <var class="Arg">P</var> and <var class="Arg">Q</var>, which must be integers, as a list of three integers. If <var class="Arg">k</var> is a negative integer, then the values of the Lucas sequence may be nonintegral rational numbers, with denominator roughly <var class="Arg">Q</var>^<var class="Arg">k</var>.</p>
803
804 <p>Let <span class="SimpleMath">α, β</span> be the two roots of <span class="SimpleMath">x^2 - P x + Q</span> then we define <code class="code">Lucas( <var class="Arg">P</var>, <var class="Arg">Q</var>, <var class="Arg">k</var> )[1]</code> <span class="SimpleMath">= U_k = (α^k - β^k) / (α - β)</span> and <code class="code">Lucas( <var class="Arg">P</var>, <var class="Arg">Q</var>, <var class="Arg">k</var> )[2]</code> <span class="SimpleMath">= V_k = (α^k + β^k)</span> and as a convenience <code class="code">Lucas( <var class="Arg">P</var>, <var class="Arg">Q</var>, <var class="Arg">k</var> )[3]</code> <span class="SimpleMath">= Q^k</span>.</p>
805
806 <p>The following recurrence relations are easily derived from the definition <span class="SimpleMath">U_0 = 0, U_1 = 1, U_k = P U_{k-1} - Q U_{k-2}</span> and <span class="SimpleMath">V_0 = 2, V_1 = P, V_k = P V_{k-1} - Q V_{k-2}</span>. Those relations are actually used to define <code class="func">Lucas</code> if <span class="SimpleMath">α = β</span>.</p>
807
808 <p>Also the more complex relations used in <code class="func">Lucas</code> can be easily derived <span class="SimpleMath">U_2k = U_k V_k</span>, <span class="SimpleMath">U_{2k+1} = (P U_2k + V_2k) / 2</span> and <span class="SimpleMath">V_2k = V_k^2 - 2 Q^k</span>, <span class="SimpleMath">V_{2k+1} = ((P^2-4Q) U_2k + P V_2k) / 2</span>.</p>
809
810 <p><code class="code">Fibonacci(<var class="Arg">k</var>)</code> (see <code class="func">Fibonacci</code> (<a href="chap16.html#X85AE1D70803A886C"><span class="RefLink">16.3-1</span></a>)) is simply <code class="code">Lucas(1,-1,<var class="Arg">k</var>)[1]</code>. In an abuse of notation, the sequence <code class="code">Lucas(1,-1,<var class="Arg">k</var>)[2]</code> is sometimes called the Lucas sequence.</p>
811
812
813 <div class="example"><pre>
814 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..10], i -&gt; Lucas(1,-2,i)[1] ); # 2^k - (-1)^k)/3</span>
815 [ 0, 1, 1, 3, 5, 11, 21, 43, 85, 171, 341 ]
816 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..10], i -&gt; Lucas(1,-2,i)[2] ); # 2^k + (-1)^k</span>
817 [ 2, 1, 5, 7, 17, 31, 65, 127, 257, 511, 1025 ]
818 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..10], i -&gt; Lucas(1,-1,i)[1] ); # Fibonacci sequence</span>
819 [ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
820 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List( [0..10], i -&gt; Lucas(2,1,i)[1] ); # the roots are equal</span>
821 [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
822 </pre></div>
823
824 <p><a id="X821888E77EB43F67" name="X821888E77EB43F67"></a></p>
825
826 <h4>16.4 <span class="Heading">Permanent of a Matrix</span></h4>
827
828 <p><a id="X7F0942DD83BBAB7A" name="X7F0942DD83BBAB7A"></a></p>
829
830 <h5>16.4-1 Permanent</h5>
831
832 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Permanent</code>( <var class="Arg">mat</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
833 <p>returns the <em>permanent</em> of the matrix <var class="Arg">mat</var>. The permanent is defined by <span class="SimpleMath">∑_{p ∈ Sym(n)} ∏_{i = 1}^n mat[i][i^p]</span>.</p>
834
835 <p>Note the similarity of the definition of the permanent to the definition of the determinant (see <code class="func">DeterminantMat</code> (<a href="chap24.html#X8488D69A7ADDB4E2"><span class="RefLink">24.4-4</span></a>)). In fact the only difference is the missing sign of the permutation. However the permanent is quite unlike the determinant, for example it is not multilinear or alternating. It has however important combinatorial properties.</p>
836
837
838 <div class="example"><pre>
839 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Permanent( [[0,1,1,1],</span>
840 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [1,0,1,1],</span>
841 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [1,1,0,1],</span>
842 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [1,1,1,0]] ); # inefficient way to compute NrDerangements([1..4])</span>
843 9
844 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput"># 24 permutations fit the projective plane of order 2:</span>
845 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Permanent( [[1,1,0,1,0,0,0],</span>
846 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [0,1,1,0,1,0,0],</span>
847 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [0,0,1,1,0,1,0],</span>
848 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [0,0,0,1,1,0,1],</span>
849 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [1,0,0,0,1,1,0],</span>
850 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [0,1,0,0,0,1,1],</span>
851 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> [1,0,1,0,0,0,1]] );</span>
852 24
853 </pre></div>
854
855
856 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap15.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap17.html">[Next Chapter]</a>&nbsp; </div>
857
858
859 <div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
860
861 <hr />
862 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
863 </body>
864 </html>