The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and...
Transcript of The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and...
![Page 1: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/1.jpg)
The Frobenius Problem and Its Generalizations
Jeffrey ShallitSchool of Computer Science
University of WaterlooWaterloo, Ontario N2L 3G1
http://www.cs.uwaterloo.ca/~shallit
1 / 139
![Page 2: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/2.jpg)
An Advertisement
Just out from Cambridge University Press! Order your copy today!
2 / 139
![Page 3: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/3.jpg)
The Frobenius Problem
The Frobenius problem is the following: given positive integersx1, x2, . . . , xn with gcd(x1, x2, . . . , xn) = 1, compute the largestinteger not representable as a non-negative integer linearcombination of the xi .
3 / 139
![Page 4: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/4.jpg)
The Frobenius Problem
The Frobenius problem is the following: given positive integersx1, x2, . . . , xn with gcd(x1, x2, . . . , xn) = 1, compute the largestinteger not representable as a non-negative integer linearcombination of the xi .
This largest integer is sometimes denoted g(x1, . . . , xn).
4 / 139
![Page 5: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/5.jpg)
The Frobenius Problem
The Frobenius problem is the following: given positive integersx1, x2, . . . , xn with gcd(x1, x2, . . . , xn) = 1, compute the largestinteger not representable as a non-negative integer linearcombination of the xi .
This largest integer is sometimes denoted g(x1, . . . , xn).
The restriction gcd(x1, x2, . . . , xn) = 1 is necessary for thedefinition to be meaningful, for otherwise every non-negativeinteger linear combination is divisible by this gcd.
5 / 139
![Page 6: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/6.jpg)
The Chicken McNuggets Problem
A famous problem in elementary arithmetic books:
6 / 139
![Page 7: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/7.jpg)
The Chicken McNuggets Problem
A famous problem in elementary arithmetic books:
At McDonald’s, Chicken McNuggets are available in packs of
either 6, 9, or 20 nuggets. What is the largest number of
McNuggets that one cannot purchase?
7 / 139
![Page 8: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/8.jpg)
The Chicken McNuggets Problem
Answer: 43.
8 / 139
![Page 9: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/9.jpg)
The Chicken McNuggets Problem
Answer: 43.
To see that 43 is not representable, observe that we can chooseeither 0, 1, or 2 packs of 20. If we choose 0 or 1 packs, then wehave to represent 43 or 23 as a linear combination of 6 and 9,which is impossible. So we have to choose two packs of 20. Butthen we cannot get 43.
9 / 139
![Page 10: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/10.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 6
10 / 139
![Page 11: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/11.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 645 = 0 · 20 + 3 · 9 + 3 · 6
11 / 139
![Page 12: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/12.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 645 = 0 · 20 + 3 · 9 + 3 · 646 = 2 · 20 + 0 · 9 + 1 · 6
12 / 139
![Page 13: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/13.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 645 = 0 · 20 + 3 · 9 + 3 · 646 = 2 · 20 + 0 · 9 + 1 · 647 = 1 · 20 + 3 · 9 + 0 · 6
13 / 139
![Page 14: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/14.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 645 = 0 · 20 + 3 · 9 + 3 · 646 = 2 · 20 + 0 · 9 + 1 · 647 = 1 · 20 + 3 · 9 + 0 · 648 = 0 · 20 + 0 · 9 + 8 · 6
14 / 139
![Page 15: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/15.jpg)
The Chicken McNuggets Example
To see that every larger number is representable, note that
44 = 1 · 20 + 0 · 9 + 4 · 645 = 0 · 20 + 3 · 9 + 3 · 646 = 2 · 20 + 0 · 9 + 1 · 647 = 1 · 20 + 3 · 9 + 0 · 648 = 0 · 20 + 0 · 9 + 8 · 649 = 2 · 20 + 1 · 9 + 0 · 6
and every larger number can be written as a multiple of 6 plus oneof these numbers.
15 / 139
![Page 16: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/16.jpg)
History of the Frobenius problem
I Problem discussed by Frobenius (1849–1917) in his lectures inthe late 1800’s — but Frobenius never published anything
16 / 139
![Page 17: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/17.jpg)
History of the Frobenius problem
I Problem discussed by Frobenius (1849–1917) in his lectures inthe late 1800’s — but Frobenius never published anything
I A related problem was discussed by Sylvester in 1882: he gavea formula for h(x1, x2, . . . , xn), the total number ofnon-negative integers not representable as a linearcombination of the xi , in the case n = 2
17 / 139
![Page 18: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/18.jpg)
History of the Frobenius problem
I Problem discussed by Frobenius (1849–1917) in his lectures inthe late 1800’s — but Frobenius never published anything
I A related problem was discussed by Sylvester in 1882: he gavea formula for h(x1, x2, . . . , xn), the total number ofnon-negative integers not representable as a linearcombination of the xi , in the case n = 2
I Applications of the Frobenius problem occur in numbertheory, automata theory, sorting algorithms, etc.
18 / 139
![Page 19: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/19.jpg)
Research on the Frobenius problem
I Formulas for g where dimension is bounded
19 / 139
![Page 20: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/20.jpg)
Research on the Frobenius problem
I Formulas for g where dimension is bounded
I Upper and lower bounds for g
20 / 139
![Page 21: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/21.jpg)
Research on the Frobenius problem
I Formulas for g where dimension is bounded
I Upper and lower bounds for g
I Formulas for g in special cases
21 / 139
![Page 22: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/22.jpg)
Research on the Frobenius problem
I Formulas for g where dimension is bounded
I Upper and lower bounds for g
I Formulas for g in special cases
I Complexity of computing g
22 / 139
![Page 23: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/23.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
23 / 139
![Page 24: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/24.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
Proof. Suppose xy − x − y is representable as ax + by .
24 / 139
![Page 25: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/25.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
Proof. Suppose xy − x − y is representable as ax + by .
Then, taking the result modulo x , we have −y ≡ by (mod x), sob ≡ −1 (mod x).
25 / 139
![Page 26: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/26.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
Proof. Suppose xy − x − y is representable as ax + by .
Then, taking the result modulo x , we have −y ≡ by (mod x), sob ≡ −1 (mod x).
Similarly, modulo y , we get −x ≡ ax , so a ≡ −1 (mod y).
26 / 139
![Page 27: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/27.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
Proof. Suppose xy − x − y is representable as ax + by .
Then, taking the result modulo x , we have −y ≡ by (mod x), sob ≡ −1 (mod x).
Similarly, modulo y , we get −x ≡ ax , so a ≡ −1 (mod y).
But then ax + by ≥ (y − 1)x + (x − 1)y = 2xy − x − y , acontradiction.
27 / 139
![Page 28: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/28.jpg)
Formulas for g
In the case where n = 2, we have g(x , y) = xy − x − y .
Proof. Suppose xy − x − y is representable as ax + by .
Then, taking the result modulo x , we have −y ≡ by (mod x), sob ≡ −1 (mod x).
Similarly, modulo y , we get −x ≡ ax , so a ≡ −1 (mod y).
But then ax + by ≥ (y − 1)x + (x − 1)y = 2xy − x − y , acontradiction.
So xy − x − y is not representable.
28 / 139
![Page 29: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/29.jpg)
Formulas for g
To prove every integer larger than xy − x − y is representable, letc = x−1 mod y and d = y−1 mod x .
29 / 139
![Page 30: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/30.jpg)
Formulas for g
To prove every integer larger than xy − x − y is representable, letc = x−1 mod y and d = y−1 mod x . Then a simple calculationshows that (c − 1)y + (d − 1)x = xy − x − y + 1, so this gives arepresentation for g(x , y) + 1.
30 / 139
![Page 31: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/31.jpg)
Formulas for g
To prove every integer larger than xy − x − y is representable, letc = x−1 mod y and d = y−1 mod x . Then a simple calculationshows that (c − 1)y + (d − 1)x = xy − x − y + 1, so this gives arepresentation for g(x , y) + 1.
To get a representation for larger numbers, we use the extendedEuclidean algorithm to find integers e, f such that ex − fy = 1.
31 / 139
![Page 32: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/32.jpg)
Formulas for g
To prove every integer larger than xy − x − y is representable, letc = x−1 mod y and d = y−1 mod x . Then a simple calculationshows that (c − 1)y + (d − 1)x = xy − x − y + 1, so this gives arepresentation for g(x , y) + 1.
To get a representation for larger numbers, we use the extendedEuclidean algorithm to find integers e, f such that ex − fy = 1.We just add the appropriate multiple of this equation, reducing, ifnecessary, by (−y)x + xy or yx + (−x)y if a coefficient becomesnegative.
32 / 139
![Page 33: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/33.jpg)
Formulas for g
To prove every integer larger than xy − x − y is representable, letc = x−1 mod y and d = y−1 mod x . Then a simple calculationshows that (c − 1)y + (d − 1)x = xy − x − y + 1, so this gives arepresentation for g(x , y) + 1.
To get a representation for larger numbers, we use the extendedEuclidean algorithm to find integers e, f such that ex − fy = 1.We just add the appropriate multiple of this equation, reducing, ifnecessary, by (−y)x + xy or yx + (−x)y if a coefficient becomesnegative.
For example, for (x , y) = [13, 19], we find [2, 10] · [x , y ] = 216.Also [3,−2] · [x , y ] = 1. To get a representation for 217, we justadd these two vectors to get [5, 8].
33 / 139
![Page 34: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/34.jpg)
Formulas for g
For 3 numbers, more complicated (but still polynomial-time)algorithms have been given by Greenberg and Davison.
34 / 139
![Page 35: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/35.jpg)
Formulas for g
For 3 numbers, more complicated (but still polynomial-time)algorithms have been given by Greenberg and Davison.
Kannan has given a polynomial-time algorithm for any fixeddimension, but the time depends at least exponentially on thedimension and the algorithm is very complicated.
35 / 139
![Page 36: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/36.jpg)
Computational Complexity of g
Ramırez-Alfonsın has proven that computing g is NP-hard underTuring-reductions, by reducing from the integer knapsack problem.
36 / 139
![Page 37: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/37.jpg)
Computational Complexity of g
Ramırez-Alfonsın has proven that computing g is NP-hard underTuring-reductions, by reducing from the integer knapsack problem.
The integer knapsack problem is, given x1, x2, . . . , xn, and a targett, do there exist non-negative integers ai such that∑
1≤i≤n aixi = t.
37 / 139
![Page 38: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/38.jpg)
Computational Complexity of g
Ramırez-Alfonsın has proven that computing g is NP-hard underTuring-reductions, by reducing from the integer knapsack problem.
The integer knapsack problem is, given x1, x2, . . . , xn, and a targett, do there exist non-negative integers ai such that∑
1≤i≤n aixi = t.
His reduction requires 3 calls to a subroutine for the Frobeniusnumber g .
38 / 139
![Page 39: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/39.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
39 / 139
![Page 40: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/40.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination.
40 / 139
![Page 41: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/41.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable.
41 / 139
![Page 42: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/42.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise.
42 / 139
![Page 43: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/43.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise. Clearly if j is representable, so is j + an,so each consecutive block has 1’s in the same positions as theprevious, plus maybe some new 1’s.
43 / 139
![Page 44: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/44.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise. Clearly if j is representable, so is j + an,so each consecutive block has 1’s in the same positions as theprevious, plus maybe some new 1’s. In fact, new 1’s must appearin each consecutive block, until it is full of 1’s, for otherwise theFrobenius number would be infinite.
44 / 139
![Page 45: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/45.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise. Clearly if j is representable, so is j + an,so each consecutive block has 1’s in the same positions as theprevious, plus maybe some new 1’s. In fact, new 1’s must appearin each consecutive block, until it is full of 1’s, for otherwise theFrobenius number would be infinite. So we need to examine atmost an blocks.
45 / 139
![Page 46: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/46.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise. Clearly if j is representable, so is j + an,so each consecutive block has 1’s in the same positions as theprevious, plus maybe some new 1’s. In fact, new 1’s must appearin each consecutive block, until it is full of 1’s, for otherwise theFrobenius number would be infinite. So we need to examine atmost an blocks. Once a block is full, every subsequent number isrepresentable.
46 / 139
![Page 47: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/47.jpg)
Upper bound for the Frobenius number
A simple upper bound can be obtained by dynamic programming.
Suppose a1 < a2 < · · · < an. Consider testing each number0, 1, 2, . . . in turn to see if it is representable as a non-negativeinteger linear combination. Then r is representable if and only if atleast one of r − a1, r − a2, . . . , r − an is representable. Now groupthe numbers in blocks of size an, and write a 1 if the number isrepresentable, 0 otherwise. Clearly if j is representable, so is j + an,so each consecutive block has 1’s in the same positions as theprevious, plus maybe some new 1’s. In fact, new 1’s must appearin each consecutive block, until it is full of 1’s, for otherwise theFrobenius number would be infinite. So we need to examine atmost an blocks. Once a block is full, every subsequent number isrepresentable. Thus we have shown g(a1, a2, . . . , an) < a2n.
47 / 139
![Page 48: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/48.jpg)
Applications of the Frobenius Number
I Shell sort - a sorting algorithm devised by D. Shell in 1959.
48 / 139
![Page 49: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/49.jpg)
Applications of the Frobenius Number
I Shell sort - a sorting algorithm devised by D. Shell in 1959.
I Basic idea: arrange list in j columns; sort columns; decrease j ;repeat
49 / 139
![Page 50: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/50.jpg)
Shellsort Example
Start with 10 5 12 13 4 6 9 11 8 1 7
50 / 139
![Page 51: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/51.jpg)
Shellsort Example
Start with 10 5 12 13 4 6 9 11 8 1 7Arrange in 5 columns:
10 5 12 13 46 9 11 8 17
51 / 139
![Page 52: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/52.jpg)
Shellsort Example
Start with 10 5 12 13 4 6 9 11 8 1 7Arrange in 5 columns:
10 5 12 13 46 9 11 8 17
Sort each column:
6 5 11 8 17 9 12 13 410
52 / 139
![Page 53: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/53.jpg)
Shellsort Example
Now arrange in 3 columns:
6 5 118 1 79 12 134 10
53 / 139
![Page 54: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/54.jpg)
Shellsort Example
Now arrange in 3 columns:
6 5 118 1 79 12 134 10
Sort each column:
4 1 76 5 118 10 139 12
54 / 139
![Page 55: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/55.jpg)
Shellsort Example
Finally, sort the remaining elements:1 4 5 6 7 8 9 10 11 12 13
55 / 139
![Page 56: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/56.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
56 / 139
![Page 57: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/57.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
57 / 139
![Page 58: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/58.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used.
58 / 139
![Page 59: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/59.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used. (Powersof 2, minus 1.)
59 / 139
![Page 60: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/60.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used. (Powersof 2, minus 1.)
I It is O(n4/3) if increments 1, 8, 23, 77, . . . are used
60 / 139
![Page 61: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/61.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used. (Powersof 2, minus 1.)
I It is O(n4/3) if increments 1, 8, 23, 77, . . . are used (Numbersof the form 4j+1 + 3 · 2j + 1).
61 / 139
![Page 62: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/62.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used. (Powersof 2, minus 1.)
I It is O(n4/3) if increments 1, 8, 23, 77, . . . are used (Numbersof the form 4j+1 + 3 · 2j + 1).
I It is O(n(log n)2) if increments1, 2, 3, 4, 6, 9, 8, 12, 18, 27, 16, 24, . . . are used
62 / 139
![Page 63: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/63.jpg)
Choosing the Increments in Shellsort
I Running time depends on increments
I Original version used increments a power of 2, but this givesquadratic running time.
I It is O(n3/2) if increments 1, 3, 7, 15, 31, . . . are used. (Powersof 2, minus 1.)
I It is O(n4/3) if increments 1, 8, 23, 77, . . . are used (Numbersof the form 4j+1 + 3 · 2j + 1).
I It is O(n(log n)2) if increments1, 2, 3, 4, 6, 9, 8, 12, 18, 27, 16, 24, . . . are used (Numbers of theform 2i3j).
63 / 139
![Page 64: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/64.jpg)
Shellsort and the Frobenius Problem
Theorem. The number of steps required to r -sort a file a[1..N]that is already r1, r2, . . . , rt-sorted is ≤ N
rg(r1, r2, . . . , rt).
64 / 139
![Page 65: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/65.jpg)
Shellsort and the Frobenius Problem
Theorem. The number of steps required to r -sort a file a[1..N]that is already r1, r2, . . . , rt-sorted is ≤ N
rg(r1, r2, . . . , rt).
Proof. The number of steps to insert a[i ] is the number ofelements in a[i − r ], a[i − 2r ], . . . that are greater than a[i ].
65 / 139
![Page 66: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/66.jpg)
Shellsort and the Frobenius Problem
Theorem. The number of steps required to r -sort a file a[1..N]that is already r1, r2, . . . , rt-sorted is ≤ N
rg(r1, r2, . . . , rt).
Proof. The number of steps to insert a[i ] is the number ofelements in a[i − r ], a[i − 2r ], . . . that are greater than a[i ]. But ifx is a linear combination of r1, r2, . . . , rt , then a[i − x ] < a[i ], sincethe file is r1, r2, . . . , rt-sorted.
66 / 139
![Page 67: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/67.jpg)
Shellsort and the Frobenius Problem
Theorem. The number of steps required to r -sort a file a[1..N]that is already r1, r2, . . . , rt-sorted is ≤ N
rg(r1, r2, . . . , rt).
Proof. The number of steps to insert a[i ] is the number ofelements in a[i − r ], a[i − 2r ], . . . that are greater than a[i ]. But ifx is a linear combination of r1, r2, . . . , rt , then a[i − x ] < a[i ], sincethe file is r1, r2, . . . , rt-sorted. Thus the number of steps to inserta[i ] is ≤ the number of multiples of r that are not linearcombinations of r1, r2, . . . , rt .
67 / 139
![Page 68: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/68.jpg)
Shellsort and the Frobenius Problem
Theorem. The number of steps required to r -sort a file a[1..N]that is already r1, r2, . . . , rt-sorted is ≤ N
rg(r1, r2, . . . , rt).
Proof. The number of steps to insert a[i ] is the number ofelements in a[i − r ], a[i − 2r ], . . . that are greater than a[i ]. But ifx is a linear combination of r1, r2, . . . , rt , then a[i − x ] < a[i ], sincethe file is r1, r2, . . . , rt-sorted. Thus the number of steps to inserta[i ] is ≤ the number of multiples of r that are not linearcombinations of r1, r2, . . . , rt . This number is ≤ g(r1, r2, . . . , rt)/r .
68 / 139
![Page 69: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/69.jpg)
The Frobenius Problem and NFA to DFA Conversion
As is well-known, when converting an NFA of n states to anequivalent DFA via the subset construction, 2n states are sufficient.
69 / 139
![Page 70: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/70.jpg)
The Frobenius Problem and NFA to DFA Conversion
As is well-known, when converting an NFA of n states to anequivalent DFA via the subset construction, 2n states are sufficient.
What may be less well-known is that this construction is optimal inthe case of a binary or larger input alphabet, in that there existlanguages L that can be accepted by an NFA with n states, but noDFA with < 2n states accepts L.
70 / 139
![Page 71: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/71.jpg)
The Frobenius Problem and NFA to DFA Conversion
As is well-known, when converting an NFA of n states to anequivalent DFA via the subset construction, 2n states are sufficient.
What may be less well-known is that this construction is optimal inthe case of a binary or larger input alphabet, in that there existlanguages L that can be accepted by an NFA with n states, but noDFA with < 2n states accepts L.
However, for unary languages, the 2n bound is not attainable.
71 / 139
![Page 72: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/72.jpg)
Unary NFA to DFA Conversion
It can be proved that approximately e√
n log n states are necessaryand sufficient in the worst case to go from a unary n-state NFA toa DFA.
72 / 139
![Page 73: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/73.jpg)
Unary NFA to DFA Conversion
It can be proved that approximately e√
n log n states are necessaryand sufficient in the worst case to go from a unary n-state NFA toa DFA.
Chrobak showed that any unary n-state NFA can be put into acertain normal form, where there is a “tail” of < n2 states, followedby a single nondeterministic state which has branches into differentcycles, where the total number of states in all the cycles is ≤ n.
73 / 139
![Page 74: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/74.jpg)
Unary NFA to DFA Conversion
It can be proved that approximately e√
n log n states are necessaryand sufficient in the worst case to go from a unary n-state NFA toa DFA.
Chrobak showed that any unary n-state NFA can be put into acertain normal form, where there is a “tail” of < n2 states, followedby a single nondeterministic state which has branches into differentcycles, where the total number of states in all the cycles is ≤ n.
The bound of n2 for the number of states in the tail comes fromthe bound we have already seen on the Frobenius problem.
74 / 139
![Page 75: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/75.jpg)
An Exercise
Use the Frobenius problem on two variables to show that thelanguage
Ln = {ai : i 6= n}can be accepted by an NFA with O(
√n) states.
75 / 139
![Page 76: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/76.jpg)
Related Problems
As we already have seen, Sylvester published a paper in 1882 wherehe defined h(x1, x2, . . . , xn) to be the total number of integers notrepresentable as an integer linear combination of the xi .
76 / 139
![Page 77: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/77.jpg)
Related Problems
As we already have seen, Sylvester published a paper in 1882 wherehe defined h(x1, x2, . . . , xn) to be the total number of integers notrepresentable as an integer linear combination of the xi .
He also gave the formula h(x1, x2) =12(x1 − 1)(x2 − 1).
77 / 139
![Page 78: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/78.jpg)
Related Problems
As we already have seen, Sylvester published a paper in 1882 wherehe defined h(x1, x2, . . . , xn) to be the total number of integers notrepresentable as an integer linear combination of the xi .
He also gave the formula h(x1, x2) =12(x1 − 1)(x2 − 1).
There is a very simple proof of this formula. Consider all thenumbers between 0 and (x1 − 1)(x2 − 1). Then it is not hard tosee that every representable number in this range is paired with anon-representable number via the map c → c ′, wherec ′ = (x1 − 1)(x2 − 1)− c − 1, and vice-versa.
78 / 139
![Page 79: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/79.jpg)
Related Problems
As we already have seen, Sylvester published a paper in 1882 wherehe defined h(x1, x2, . . . , xn) to be the total number of integers notrepresentable as an integer linear combination of the xi .
He also gave the formula h(x1, x2) =12(x1 − 1)(x2 − 1).
There is a very simple proof of this formula. Consider all thenumbers between 0 and (x1 − 1)(x2 − 1). Then it is not hard tosee that every representable number in this range is paired with anon-representable number via the map c → c ′, wherec ′ = (x1 − 1)(x2 − 1)− c − 1, and vice-versa.
However, the complexity of computing h is apparently still open(but see next slide)
79 / 139
![Page 80: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/80.jpg)
Computing h is NP-hard
After my talk at DLT ’08, Pawel Gawrychowski pointed out thefollowing very simple argument that computing h is NP-hard:
Theorem. h(a1, a2, . . . , ak) = h(a1, a2, . . . , ak , d) if and only iff d
can be expressed as a non-negative integer linear combination ofthe ai .
It follows that the integer knapsack problem (known to beNP-complete) can be reduced to the problem of computing h, andso computing h is also NP-hard.
80 / 139
![Page 81: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/81.jpg)
The Local Postage Stamp Problem
In this problem, we are given a set of denominations1 = x1, x2, . . . , xk of stamps, and an envelope that can contain atmost t stamps. We want to determine the smallest amount ofpostage we cannot provide. Call it Nt(x1, x2, . . . , xk).
81 / 139
![Page 82: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/82.jpg)
The Local Postage Stamp Problem
In this problem, we are given a set of denominations1 = x1, x2, . . . , xk of stamps, and an envelope that can contain atmost t stamps. We want to determine the smallest amount ofpostage we cannot provide. Call it Nt(x1, x2, . . . , xk).
For example, N3(1, 4, 7, 8) = 25.
82 / 139
![Page 83: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/83.jpg)
The Local Postage Stamp Problem
In this problem, we are given a set of denominations1 = x1, x2, . . . , xk of stamps, and an envelope that can contain atmost t stamps. We want to determine the smallest amount ofpostage we cannot provide. Call it Nt(x1, x2, . . . , xk).
For example, N3(1, 4, 7, 8) = 25.
Many papers have been written about this problem, especially inGermany and Norway. Algorithms have been given for manyspecial cases.
83 / 139
![Page 84: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/84.jpg)
The Local Postage Stamp Problem
In this problem, we are given a set of denominations1 = x1, x2, . . . , xk of stamps, and an envelope that can contain atmost t stamps. We want to determine the smallest amount ofpostage we cannot provide. Call it Nt(x1, x2, . . . , xk).
For example, N3(1, 4, 7, 8) = 25.
Many papers have been written about this problem, especially inGermany and Norway. Algorithms have been given for manyspecial cases.
Alter and Barnett asked (1980) if Nt(x1, x2, . . . , xk) can be“expressed by a simple formula”.
84 / 139
![Page 85: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/85.jpg)
The Local Postage Stamp Problem
In this problem, we are given a set of denominations1 = x1, x2, . . . , xk of stamps, and an envelope that can contain atmost t stamps. We want to determine the smallest amount ofpostage we cannot provide. Call it Nt(x1, x2, . . . , xk).
For example, N3(1, 4, 7, 8) = 25.
Many papers have been written about this problem, especially inGermany and Norway. Algorithms have been given for manyspecial cases.
Alter and Barnett asked (1980) if Nt(x1, x2, . . . , xk) can be“expressed by a simple formula”.
The answer is, probably not. I proved computing Nt(x1, x2, . . . , xk)is NP-hard in 2001.
85 / 139
![Page 86: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/86.jpg)
The Global Postage-Stamp Problem
The global postage-stamp problem is yet another variant: now weare given a limit t on the number of stamps to be used, and aninteger k, and the goal is to find a set of k denominationsx1, x2, . . . , xk that maximizes Nt(x1, x2, . . . , xk).
86 / 139
![Page 87: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/87.jpg)
The Global Postage-Stamp Problem
The global postage-stamp problem is yet another variant: now weare given a limit t on the number of stamps to be used, and aninteger k, and the goal is to find a set of k denominationsx1, x2, . . . , xk that maximizes Nt(x1, x2, . . . , xk).
The complexity of this problem is unknown.
87 / 139
![Page 88: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/88.jpg)
The Optimal Coin Change Problem
Yet another variant is the optimal change problem: here we aregiven a bound on the number of distinct coin denominations wecan use (but allowing arbitrarily many of each denomination), andwe want to find a set that minimizes the average number of coinsneeded to make each amount in some range.
88 / 139
![Page 89: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/89.jpg)
The Optimal Coin Change Problem
Yet another variant is the optimal change problem: here we aregiven a bound on the number of distinct coin denominations wecan use (but allowing arbitrarily many of each denomination), andwe want to find a set that minimizes the average number of coinsneeded to make each amount in some range.
For example, in Canada we currently use 4 denominations forchange: 1, 5, 10, and 25. These can make change for everyamount between 0 and 99, with an average cost of 4.7 coins peramount.
89 / 139
![Page 90: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/90.jpg)
The Optimal Coin Change Problem
Yet another variant is the optimal change problem: here we aregiven a bound on the number of distinct coin denominations wecan use (but allowing arbitrarily many of each denomination), andwe want to find a set that minimizes the average number of coinsneeded to make each amount in some range.
For example, in Canada we currently use 4 denominations forchange: 1, 5, 10, and 25. These can make change for everyamount between 0 and 99, with an average cost of 4.7 coins peramount.
It turns out that the system of denominations (1, 5, 18, 25) isoptimal, with an average cost of only 3.89 coins per amount.
90 / 139
![Page 91: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/91.jpg)
Improving the Current Coin System
You could also ask, what single denomination could we add to thecurrent system to improve its efficiency in making change?
91 / 139
![Page 92: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/92.jpg)
Improving the Current Coin System
You could also ask, what single denomination could we add to thecurrent system to improve its efficiency in making change?
The answer is, add a 32-cent piece.
92 / 139
![Page 93: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/93.jpg)
Improving the Current Coin System
You could also ask, what single denomination could we add to thecurrent system to improve its efficiency in making change?
The answer is, add a 32-cent piece.
For Canada, where 1-dollar and 2-dollar coins are in generalcirculation, the best coin to add is an 83-cent piece.
93 / 139
![Page 94: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/94.jpg)
Improving the Current Coin System
You could also ask, what single denomination could we add to thecurrent system to improve its efficiency in making change?
The answer is, add a 32-cent piece.
For Canada, where 1-dollar and 2-dollar coins are in generalcirculation, the best coin to add is an 83-cent piece.
94 / 139
![Page 95: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/95.jpg)
Improving the Japanese System
9/16/08 4:22 AMtest.html
Page 1 of 1file:///Users/shallit/Desktop/test.html
Japan uses a system based on 1 and 5: there are coins of 1 yen, 5yen, 10 yen, 50 yen, 100 yen, and 500 yen. But switching to 1 and3 (or 1 and 4) would decrease the average number of coins used.
95 / 139
![Page 96: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/96.jpg)
Generalizing the Frobenius Problem to Words
Before, we had defined g(x1, x2, . . . , xk) to be the largest integernot representable as a non-negative integer linear combination ofthe xi .
96 / 139
![Page 97: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/97.jpg)
Generalizing the Frobenius Problem to Words
Before, we had defined g(x1, x2, . . . , xk) to be the largest integernot representable as a non-negative integer linear combination ofthe xi .
We can now replace the integers xi with words (strings of symbolsover a finite alphabet Σ), and ask, what is the right generalizationof the Frobenius problem?
97 / 139
![Page 98: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/98.jpg)
Generalizing the Frobenius Problem to Words
There are several possible answers.
98 / 139
![Page 99: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/99.jpg)
Generalizing the Frobenius Problem to Words
There are several possible answers.
One is as follows:
Instead of non-negative integer linear combinations of the xi , wecould consider the regular expressions
x∗1x∗2 · · · x∗k
99 / 139
![Page 100: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/100.jpg)
Generalizing the Frobenius Problem to Words
There are several possible answers.
One is as follows:
Instead of non-negative integer linear combinations of the xi , wecould consider the regular expressions
x∗1x∗2 · · · x∗k
or{x1, x2, . . . , xk}∗.
100 / 139
![Page 101: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/101.jpg)
Generalizing the Frobenius Problem to Words
Instead of the condition that gcd(x1, x2, . . . , xk) = 1, which wasused to ensure that there the number of unrepresentable integers isfinite, we could demand that
Σ∗ − x∗1 x∗2 · · · x∗k
orΣ∗ − {x1, x2, . . . , xk}∗
be finite, or in other words, that
x∗1x∗2 · · · x∗k
or{x1, x2, . . . , xk}∗
be co-finite.
101 / 139
![Page 102: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/102.jpg)
Generalizing the Frobenius Problem to Words
And instead of looking for the largest non-representable integer, wecould ask for the length of the longest word not in
x∗1x∗2 · · · x∗k
or{x1, x2, . . . , xk}∗.
102 / 139
![Page 103: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/103.jpg)
x∗1x∗
2 · · · x∗k
Theorem. Let x1, x2, . . . , xk ∈ Σ+. Then x∗1 x∗2 · · · x∗k is co-finite if
and only if |Σ| = 1 and gcd(|x1|, . . . , |xk |) = 1.
Proof. Let Q = x∗1 x∗2 · · · x∗k .
103 / 139
![Page 104: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/104.jpg)
x∗1x∗
2 · · · x∗k
Theorem. Let x1, x2, . . . , xk ∈ Σ+. Then x∗1 x∗2 · · · x∗k is co-finite if
and only if |Σ| = 1 and gcd(|x1|, . . . , |xk |) = 1.
Proof. Let Q = x∗1 x∗2 · · · x∗k .
If |Σ| = 1 and gcd(|x1|, . . . , |xk |) = 1, then every sufficiently longunary word can be obtained by concatenations of the xi , so Q isco-finite.
104 / 139
![Page 105: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/105.jpg)
x∗1x∗
2 · · · x∗k
Theorem. Let x1, x2, . . . , xk ∈ Σ+. Then x∗1 x∗2 · · · x∗k is co-finite if
and only if |Σ| = 1 and gcd(|x1|, . . . , |xk |) = 1.
Proof. Let Q = x∗1 x∗2 · · · x∗k .
If |Σ| = 1 and gcd(|x1|, . . . , |xk |) = 1, then every sufficiently longunary word can be obtained by concatenations of the xi , so Q isco-finite.
For the other direction, suppose Q is co-finite. If |Σ| = 1, letgcd(|x1|, . . . , |xk |) = d . If d > 1, Q contains only words of lengthdivisible by d , and so is not co-finite. So d = 1.
105 / 139
![Page 106: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/106.jpg)
x∗1x∗
2 · · · x∗k
Hence assume |Σ| ≥ 2, and let a, b be distinct letters in Σ.
106 / 139
![Page 107: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/107.jpg)
x∗1x∗
2 · · · x∗k
Hence assume |Σ| ≥ 2, and let a, b be distinct letters in Σ.
Let ` = max1≤i≤k |xi |, the length of the longest word among thexi .
107 / 139
![Page 108: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/108.jpg)
x∗1x∗
2 · · · x∗k
Hence assume |Σ| ≥ 2, and let a, b be distinct letters in Σ.
Let ` = max1≤i≤k |xi |, the length of the longest word among thexi .
Let Q ′ = ((a2`b2`)k)+. Then we claim that Q ′ ∩ Q = ∅.
108 / 139
![Page 109: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/109.jpg)
x∗1x∗
2 · · · x∗k
Hence assume |Σ| ≥ 2, and let a, b be distinct letters in Σ.
Let ` = max1≤i≤k |xi |, the length of the longest word among thexi .
Let Q ′ = ((a2`b2`)k)+. Then we claim that Q ′ ∩ Q = ∅.
For if none of the xi consists of powers of a single letter, then thelongest block of consecutive identical letters in any word in Q is< 2`, so no word in Q ′ can be in Q.
109 / 139
![Page 110: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/110.jpg)
x∗1x∗
2 · · · x∗k
Otherwise, say some of the xi consist of powers of a single letter.
110 / 139
![Page 111: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/111.jpg)
x∗1x∗
2 · · · x∗k
Otherwise, say some of the xi consist of powers of a single letter.
Take any word w in Q, and count the number n(w) of maximalblocks of 2` or more consecutive identical letters in w . (Here“maximal” means such a block is delimited on both sides by eitherthe beginning or end of the word, or a different letter.)
111 / 139
![Page 112: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/112.jpg)
x∗1x∗
2 · · · x∗k
Otherwise, say some of the xi consist of powers of a single letter.
Take any word w in Q, and count the number n(w) of maximalblocks of 2` or more consecutive identical letters in w . (Here“maximal” means such a block is delimited on both sides by eitherthe beginning or end of the word, or a different letter.)
Clearly n(w) ≤ k.
112 / 139
![Page 113: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/113.jpg)
x∗1x∗
2 · · · x∗k
Otherwise, say some of the xi consist of powers of a single letter.
Take any word w in Q, and count the number n(w) of maximalblocks of 2` or more consecutive identical letters in w . (Here“maximal” means such a block is delimited on both sides by eitherthe beginning or end of the word, or a different letter.)
Clearly n(w) ≤ k.
But n(w ′) ≥ 2k for any word w ′ in Q ′. Thus Q is not co-finite, asit omits all the words in Q ′.
113 / 139
![Page 114: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/114.jpg)
{x1, x2, . . . , xk}∗
Suppose max1≤i≤k |xi | = n.
114 / 139
![Page 115: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/115.jpg)
{x1, x2, . . . , xk}∗
Suppose max1≤i≤k |xi | = n.
We can obtain an exponential upper bound on length of thelongest omitted word, as follows:
115 / 139
![Page 116: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/116.jpg)
{x1, x2, . . . , xk}∗
Suppose max1≤i≤k |xi | = n.
We can obtain an exponential upper bound on length of thelongest omitted word, as follows:
Given x1, x2, . . . , xk , create a DFA accepting Σ∗−{x1, x2, . . . , xk}∗.This DFA keeps track of the last n− 1 symbols seen, together withmarkers indicating all positions within those n− 1 symbols where apartial factorization of the input into the xi could end.
116 / 139
![Page 117: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/117.jpg)
{x1, x2, . . . , xk}∗
Suppose max1≤i≤k |xi | = n.
We can obtain an exponential upper bound on length of thelongest omitted word, as follows:
Given x1, x2, . . . , xk , create a DFA accepting Σ∗−{x1, x2, . . . , xk}∗.This DFA keeps track of the last n− 1 symbols seen, together withmarkers indicating all positions within those n− 1 symbols where apartial factorization of the input into the xi could end.
Since this DFA accepts a finite language, the longest word itaccepts is bounded by the number of states.
117 / 139
![Page 118: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/118.jpg)
{x1, x2, . . . , xk}∗
But is this exponential upper bound attainable?
118 / 139
![Page 119: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/119.jpg)
{x1, x2, . . . , xk}∗
But is this exponential upper bound attainable?
Yes.
119 / 139
![Page 120: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/120.jpg)
{x1, x2, . . . , xk}∗
But is this exponential upper bound attainable?
Yes.
My student Zhi Xu has recently produced a class of examples{x1, x2, . . . , xk} in which the length of the longest word is n, butthe longest word in Σ∗ − {x1, x2, . . . , xk}∗ is exponential in n.
120 / 139
![Page 121: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/121.jpg)
{x1, x2, . . . , xk}∗: Zhi Xu’s Examples
Let r(n, k, l) denote the word of length l representing n in base k,possibly with leading zeros. For example, r(3, 2, 3) = 011.
121 / 139
![Page 122: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/122.jpg)
{x1, x2, . . . , xk}∗: Zhi Xu’s Examples
Let r(n, k, l) denote the word of length l representing n in base k,possibly with leading zeros. For example, r(3, 2, 3) = 011.
Let T (m, n) = {r(i , |Σ|, n −m)02m−nr(i + 1, |Σ|, n −m) : 0 ≤i ≤ |Σ|n−m − 2}.
122 / 139
![Page 123: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/123.jpg)
{x1, x2, . . . , xk}∗: Zhi Xu’s Examples
Let r(n, k, l) denote the word of length l representing n in base k,possibly with leading zeros. For example, r(3, 2, 3) = 011.
Let T (m, n) = {r(i , |Σ|, n −m)02m−nr(i + 1, |Σ|, n −m) : 0 ≤i ≤ |Σ|n−m − 2}.
Theorem. Let m, n be integers with 0 < m < n < 2m andgcd(m, n) = 1, and let S = Σm +Σn − T (m, n). Then S∗ isco-finite and the longest words not in S∗ are of length g(m, l),where l = m|Σ|n−m + n −m.
123 / 139
![Page 124: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/124.jpg)
{x1, x2, . . . , xk}∗: Zhi Xu’s Examples
Let r(n, k, l) denote the word of length l representing n in base k,possibly with leading zeros. For example, r(3, 2, 3) = 011.
Let T (m, n) = {r(i , |Σ|, n −m)02m−nr(i + 1, |Σ|, n −m) : 0 ≤i ≤ |Σ|n−m − 2}.
Theorem. Let m, n be integers with 0 < m < n < 2m andgcd(m, n) = 1, and let S = Σm +Σn − T (m, n). Then S∗ isco-finite and the longest words not in S∗ are of length g(m, l),where l = m|Σ|n−m + n −m.
Example. Let m = 3, n = 5,Σ = {0, 1}. In this case,l = 3 · 22 + 2 = 14, S = Σ3 +Σ5 − {00001, 01010, 10011}. Then alongest word not in S∗ is
00001010011 000 00001010011
of length 25 = g(3, 14).124 / 139
![Page 125: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/125.jpg)
Counting the Omitted Words
Zhi Xu has also generated some examples where the number ofomitted words is doubly exponential in n, the length of the longestword.
125 / 139
![Page 126: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/126.jpg)
Counting the Omitted Words
Zhi Xu has also generated some examples where the number ofomitted words is doubly exponential in n, the length of the longestword.
Let T ′(m, n) = {r(i , |Σ|, n −m)02m−nr(j , |Σ|, n −m) : 0 ≤ i <j ≤ |Σ|n−m − 1}.
126 / 139
![Page 127: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/127.jpg)
Counting the Omitted Words
Zhi Xu has also generated some examples where the number ofomitted words is doubly exponential in n, the length of the longestword.
Let T ′(m, n) = {r(i , |Σ|, n −m)02m−nr(j , |Σ|, n −m) : 0 ≤ i <j ≤ |Σ|n−m − 1}.
Theorem. Let m, n be integers with 0 < m < n < 2m andgcd(m, n) = 1, and let S = Σm +Σn − T ′(m, n). Then S∗ isco-finite and S∗ omits at least 2|Σ|
n−m − |Σ|n−m − 1 words.
127 / 139
![Page 128: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/128.jpg)
Counting the Omitted Words
Zhi Xu has also generated some examples where the number ofomitted words is doubly exponential in n, the length of the longestword.
Let T ′(m, n) = {r(i , |Σ|, n −m)02m−nr(j , |Σ|, n −m) : 0 ≤ i <j ≤ |Σ|n−m − 1}.
Theorem. Let m, n be integers with 0 < m < n < 2m andgcd(m, n) = 1, and let S = Σm +Σn − T ′(m, n). Then S∗ isco-finite and S∗ omits at least 2|Σ|
n−m − |Σ|n−m − 1 words.
Example. Let m = 3, n = 5,Σ = {0, 1}. ThenS = Σ3 +Σ5 − {00001, 00010, 00011, 01010, 01011, 10011}. ThenS∗ omits 1712 > 11 = 22
2 − 22 − 1 words.
128 / 139
![Page 129: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/129.jpg)
Other Possible Generalizations
Instead of considering the longest word omitted by x∗1 x∗2 · · · x∗k or
{x1, x2, . . . , xk}∗, we might consider their state complexity.
129 / 139
![Page 130: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/130.jpg)
Other Possible Generalizations
Instead of considering the longest word omitted by x∗1 x∗2 · · · x∗k or
{x1, x2, . . . , xk}∗, we might consider their state complexity.
The state complexity of a regular language L is the smallestnumber of states in any DFA that accepts L. It is written sc(L).
130 / 139
![Page 131: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/131.jpg)
Other Possible Generalizations
Instead of considering the longest word omitted by x∗1 x∗2 · · · x∗k or
{x1, x2, . . . , xk}∗, we might consider their state complexity.
The state complexity of a regular language L is the smallestnumber of states in any DFA that accepts L. It is written sc(L).
It turns out that the state complexity of {x1, x2, . . . , xk}∗ can beexponential in both the length of the longest word and the numberof words.
131 / 139
![Page 132: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/132.jpg)
State Complexity
Theorem. Let t be an integer ≥ 2, and define words as follows:
y := 01t−10
andxi := 1t−i−101i+1
for 0 ≤ i ≤ t − 2. Let St := {0, x0, x1, . . . , xt−2, y}. Then S∗t hasstate complexity 3t2t−2 + 2t−1.
132 / 139
![Page 133: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/133.jpg)
State Complexity
Theorem. Let t be an integer ≥ 2, and define words as follows:
y := 01t−10
andxi := 1t−i−101i+1
for 0 ≤ i ≤ t − 2. Let St := {0, x0, x1, . . . , xt−2, y}. Then S∗t hasstate complexity 3t2t−2 + 2t−1.
Example. For t = 6 the words in St are 0 and
y = 0111110
x0 = 1111101
x1 = 1111011
x2 = 1110111
x3 = 1101111
x4 = 1011111133 / 139
![Page 134: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/134.jpg)
State Complexity
Using similar ideas, we can also create an example achievingsubexponential state complexity for x∗1 x
∗2 · · · x∗k .
134 / 139
![Page 135: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/135.jpg)
State Complexity
Using similar ideas, we can also create an example achievingsubexponential state complexity for x∗1 x
∗2 · · · x∗k .
Theorem. Let y and xi be as defined above. LetL = (0∗x∗1 x
∗2 · · · x∗n−1y∗)e where e = (t + 1)(t − 2)/2 + 2t. Then
sc(L) ≥ 2t−2.
This example is due to Jui-Yi Kao.
135 / 139
![Page 136: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/136.jpg)
Complexity
Theorem. If S , a finite list of words, is represented by either anNFA or a regular expression, then determining if S∗ is co-finite isNP-hard and is in PSPACE.
Theorem. If S is a unary language (possibly infinite) representedby an NFA, then we can decide in polynomial time if S∗ is co-finite.
136 / 139
![Page 137: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/137.jpg)
Open Problem
We still do not know the complexity of the following problem:
137 / 139
![Page 138: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/138.jpg)
Open Problem
We still do not know the complexity of the following problem:
Given a finite list of words S = {x1, x2, . . . , xk}, determine if S∗ isco-finite.
138 / 139
![Page 139: The Frobenius Problem and Its Generalizationsshallit/Talks/frob6.pdf · The Frobenius Problem and Its Generalizations JefireyShallit SchoolofComputerScience ... Then,takingtheresultmodulox,wehave¡y·by](https://reader031.fdocuments.in/reader031/viewer/2022022609/5b91790809d3f274268bbe3b/html5/thumbnails/139.jpg)
For Further Reading
I J. L. Ramırez Alfonsın, The Diophantine Frobenius Problem,Oxford University Press, 2005.
I J. Shallit, The computational complexity of the local postagestamp problem, SIGACT News 33 (1) (March 2002), 90–94.
I J. Shallit, What this country needs is an 18-cent piece, Math.
Intelligencer 25 (2) (2003), 20–23.
I Jui-Yi Kao, J. Shallit, and Zhi Xu, “The Frobenius problem ina free monoid”, in S. Albers and P. Weil, eds., STACS 2008,
25th Annual Symposium on Theoretical Aspects of Computer
Science, 2008, pp. 421–432.
139 / 139