Some Experimental Results on the Frobenius Problem CONTENTS Frobenius problem

advertisement
Some Experimental Results on the Frobenius Problem
Matthias Beck, David Einstein, and Shelemyahu Zacks
CONTENTS
1.
2.
3.
4.
5.
Introduction
Some Geometric-Combinatorial Ingredients
Special Cases
Computations
Conjectures and Closing Remarks
We study the Frobenius problem : Given relatively prime positive integers a1 , . . . , ad , find the largest value of t (the Frobenius
number ) such that dk=1 mk ak = t has no solution in nonnegative integers m1 , . . . , md . Based on empirical data, we conjecture that except for some special cases, the Frobenius number
√
can be bounded from above by a1 a2 a3 5/4 − a1 − a2 − a3 .
1.
INTRODUCTION
Given positive integers a1 , . . . , ad with gcd(a1 , . . . , ad ) =
1, we call an integer t representable if there exist nonnegative integers m1 , . . . , md such that
t=
d
mj aj .
j=1
In this paper, we discuss the linear Diophantine problem
of Frobenius: Namely, find the largest integer which is
not representable. We call this largest integer the Frobenius number g(a1 , . . . , ad ); its study was initiated in the
19th century. For d = 2, it is well known (most probably
at least since Sylvester [Sylvester 84]) that
g(a1 , a2 ) = a1 a2 − a1 − a2
2000 AMS Subject Classification: Primary 05A15, 11Y16;
Secondary 11P21
Keywords: The linear Diophantine problem of Frobenius,
upper bounds, algorithms
(1–1)
For d > 2, all attempts for explicit formulas have proved
elusive. Two excellent survey papers on the Frobenius
problem are [Alfonsin 00] and [Selmer 77].
Our goal is to establish bounds for g(a1 , . . . , ad ). The
literature on such bounds is vast—see, for example, [Beck
et al. 02, Brauer and Shockley 62, Davison 94, Erdős
and Graham 72, Selmer 77, Vitek 75]. We focus on
the first nontrivial case d = 3; any bound for this
case yields a general bound, as one can easily see that
g(a1 , . . . , ad ) ≤ g(a1 , a2 , a3 ). All upper bounds in the
literature are proportional to the product of two of the
ak . On the other hand, Davison proved the lower bound
√
g(a1 , a2 , a3 ) ≥ 3a1 a2 a3 − a1 − a2 − a3 in [Davison 94].
Experimental data (see Figure 3) shows that this bound
is sharp in the sense that it is very often very close to
c A K Peters, Ltd.
1058-6458/2003 $ 0.50 per page
Experimental Mathematics 12:3, page 263
264
Experimental Mathematics, Vol. 12 (2003), No. 3
g(a1 , a2 , a3 ). This motivates the question whether one
√
can establish an upper bound proportional to a1 a2 a3 p
where p < 4/3 (p = 4/3 would be comparable to the
known bounds.). In this paper, we illustrate empirically,
on the basis of more than ten thousand randomly chosen
√
points, that g(a1 , a2 , a3 ) ≤ a1 a2 a3 5/4 − a1 − a2 − a3 .
2.
SOME GEOMETRIC-COMBINATORIAL
INGREDIENTS
In fact, σt (a, b; c) is a Dedekind-Rademacher sum
[Rademacher 64], as shown in [Beck et al. 02]. Hence
we can rewrite (2–1) as
t 1
1
1
t2
+
+
+
Nt (a, b, c) =
2abc 2 ab ac bc
a
b
c
1 3 3 3
+ + +
+
+
+
12 a b
c bc ac ab
1 e b (2t+a+c)
1 e a (2t+b+c)
−
πkb
πkc
πkc
4a
4b
sin a sin a
sin πka
b sin b
a−1
Another motivation for the search for an upper bound
√
proportional to a1 a2 a3 p comes from the following formula of [Beck et al. 02], which is the basis for our study:
Let a, b, c be pairwise relatively prime positive integers,
and define
Nt (a, b, c) :=# (m1 , m2 , m3 ) ∈ Z3 :
−
+ σ−t (b, c; a) + σ−t (a, c; b) + σ−t (a, b; c),
1 e a (2t+b+c)
1 e b (2t+a+c)
+
πkb
πkc
πkc
4a
4b
sin a sin a
sin πka
b sin b
λc =1=λ
(2–1)
In [Beck et al. 02], formulas analogous to (2–1) for d > 3
are given. In our case (d = 3), a straightforward calculation shows
1
4c
e
.
πkb
sin πka
c sin c
k=1
πik
(2–4)
(2–3) becomes
dilated by t. The Frobenius problem hence asks for the
largest integer dilate of this triangle that contains no
integer point; in other words, the largest t for which
Nt (a, b, c) = 0. It is also worth mentioning that the condition that a, b, and c are pairwise relatively prime is
no restriction, due to Johnson’s formula [Johnson 60]: if
m = gcd(a, b), then
a b
, , c + (m − 1)c .
(2–2)
g(a, b, c) = m g
m m
σt (a, b; c) = −
1 e c (2t+a+b)
,
πkb
4c
sin πka
c sin c
k=1
λt
(λa − 1) (λb − 1)
πik
c (−2t+a+b)
πik
b−1
k=1
c−1
+
is a Fourier-Dedekind sum.
One interpretation of
Nt (a, b, c) is the number of partitions of t with parts in
the set {a, b, c}. Geometrically, Nt (a, b, c) enumerates integer points on the triangle
(x1 , x2 , x3 ) ∈ R3 : xk ≥ 0, ax1 + bx2 + cx3 = 1 ,
c−1
πik
a−1
k=1
where
1
c
(2–3)
If we write the “periodic part” of Nt (a, b, c) as
Nt (a, b, c) =
σt (a, b; c) :=
πik
k=1
Pt (a, b, c) :=
t 1
1
1
t2
+
+
+
Nt (a, b, c) =
2abc 2 ab ac bc
a
b
c
1 3 3 3
+ + +
+
+
+
12 a b
c bc ac ab
k=1
1 e c (2t+a+b)
.
πkb
4c
sin πka
c sin c
c−1
−
πik
b−1
k=1
mk ≥ 0, am1 + bm2 + cm3 = t} .
Then
πik
t 1
1
1
t2
+
+
+
2abc 2 ab ac bc
a
b
c
1 3 3 3
+ + +
+
+
+
12 a b
c bc ac ab
− Pt (a, b, c).
If we can bound Pt (a, b, c) from above by, say, B, then the
roots of Nt (a, b, c)—and hence g(a, b, c)—can be bounded
from above:
1
1
1
+ ac
+ bc
g(a, b, c) ≤ abc − 12 ab
1
1
2
+ 4 A1 − abc 12 A2 − B
= − 12 (a + b + c)
+ 14 (abc)2 A1 − 16 abcA2 + 2B abc
1
(a2 + b2 + c2 ) − 12 (a + b + c),
= 2B abc + 12
where
A1 =
and
A2 =
3
a
+
3
b
1
ab
+
+
3
c
1
ac
+
+
a
bc
1 2
bc
+
b
ac
+
c
ab
.
From this computation, the question of the√existence of
p
an upper bound for g(a, b, c) proportional to abc comes
Beck et al.: Some Experimental Results on the Frobenius Problem
up naturally. Unfortunately, it is not clear how to bound
the periodic part Pt (a, b, c) effectively. An almost trivial bound for Pt (a, b, c) yielded in [Beck et al. 02] the
inequality
1 abc (a + b + c) − a − b − c ,
g(a, b, c) ≤
2
which is of comparable size to the other upper bounds
for g(a, b, c) in the literature. However, we believe one
can obtain bounds of smaller magnitude.
3.
4.
COMPUTATIONS
In the present section, we discuss the computation of the
Frobenius number. For convenience we computed the
number f (a, b, c) = g(a, b, c) + a + b + c. It is not hard
to see that f (a, b, c) is the largest integer that cannot
be represented by a linear combination of a, b, and c
with positive integer coefficients. The respective counting
function,
N t (a, b, c) := # (m1 , m2 , m3 ) ∈ Z3 :
SPECIAL CASES
On the path to such “better” bounds, we first have to
exclude some cases which definitely yield Frobenius numbers of size a2k . One of these cases is triples (a, b, c), such
that c is representable by a and b: by (1–1), we obtain
in this case g(a, b, c) = ab − a − b.
A second case of triples (a, b, c) that we need to exclude
are those for which a|(b+c). Brauer and Shockley [Brauer
and Shockley 62] proved that, in this case,
ab
ac
,c
− a.
g(a, b, c) = max b
b+c
b+c
Here x denotes the greatest integer not exceeding x.
An even less trivial example of special cases was given
by Lewin [Lewin 75], who studied the Frobenius number
of almost arithmetic sequences: If m, n > 0, gcd(a, n) =
1, and d ≤ a, then
g (a, ma + n, ma + 2n, . . . , ma + (d − 1) n) =
a−2
+ m − 1 a + (a − 1) n.
m
d−1
For arithmetic sequences (m = 1), this formula goes back
to Roberts [Roberts 56]; for consecutive numbers (m =
n = 1), it is due to Brauer [Brauer 42]. For the special
case d = 3, we obtain
a
− 1 a + (a − 1) n.
g(a, ma + n, ma + 2n) = m
2
As a function in a, b := ma+n, c := ma+2n, this Frobenius number grows proportionally
√ top ab, which means an
upper bound proportional to abc with p < 4/3 cannot be achieved. Hence in our computations and conjectures about upper bounds for g(a, b, c), we will exclude
the cases of one of the numbers being representable by
the other two, one number dividing the sum of the other
two, and almost arithmetic sequences. Finally, as noted
above, thanks to (2–2) we may assume without loss of
generality that a, b, and c are pairwise coprime. The
triples (a, b, c) that are not excluded will be called admissible.
265
mk > 0, am1 + bm2 + cm3 = t} ,
can also be found in [Beck et al. 02] and is closely related
to Nt (a, b, c):
t 1
1
1
t2
−
+
+
N t (a, b, c) =
2abc 2 ab ac bc
a
b
c
1 3 3 3
+ + +
+
+
+
12 a b
c bc ac ab
1 e b (−2t+a+c)
1 e a (−2t+b+c)
−
πkb
πkc
πkc
4a
4b
sin a sin a
sin πka
b sin b
a−1
−
πik
k=1
πik
k=1
1 e c (−2t+a+b)
.
πkb
4c
sin πka
c sin c
c−1
−
b−1
πik
k=1
The following illustrates our algorithm.
STEP 0: Initiate the intervals I1, I2, I3 for
the selection of the arguments a,b,c;
STEP 1: Draw at random integers a,b,c from
I1, I2, I3, respectively;
STEP 2: Test a,b,c for coprimality and for
almost arithmetic sequences;
STEP 3: IF (a,b,c are not pairwise coprime) or
IF (a,b,c are almost arithmetic)
{discard a,b,c and GOTO STEP 1}
ELSE {SET delta <- min(a,b,c);
GOTO STEP 4};
STEP 4: Compute z=sqrt(a*b*c),
SET mb <- INT(sqrt(3)*z)+delta;
SET t <- mb;
STEP 5: Compute NB(t,a,b,c);
STEP 6: IF (NB(t,a,b,c)>0)
266
Experimental Mathematics, Vol. 12 (2003), No. 3
{SET t <- t-1, and GOTO STEP 5}
ELSE {GOTO STEP 7};
STEP 7: SET f <- t;
STEP 8: IF(mb-f < delta) {SET
mb <- mb+delta
t <- mb
GOTO STEP 5}
ELSE {GOTO STEP 9};
STEP 9: PRINT f(a,b,c) <- f;
STOP.
For example, for a = 7, b = 13, c = 30 the program yields the Frobenius number f (7, 13, 30) = 95, or
g(7, 13, 30) = 45. This program was tested against arguments which yield known results, and found to be correct.
Our program is to choose at random arguments a, b, c
in a certain range (in our case [1, 750]), and test the
triplets for admissibility. For admissible triplets a, b, c,
we compute the Frobenius number f (a, b, c) based on
the straightforward observation that, once we have a =
min(a, b, c) consecutive integers which are representable,
we know that every integer beyond that interval is representable as well. We start
√ searching for roots of
N t (a, b, c) at the lower bound 3abc. If a root is found at
an integer f , we repeat this search until we find an interval of a integers t with N t (a, b, c) > 0, that is, an interval
of a representable integers. At this stopping point, the
integer f is the sought-after Frobenius number f (a, b, c).
We have created a PARI-GP program1 , following the
above algorithm. The program proved to be quite efficient, since most of the values
√ of f (a, b, c) were found to
be close to the lower bound 3abc, as shown in the analysis below. The Dedekind-Rademacher sums appearing
in (2–3) can be computed very efficiently because they
satisfy a reciprocity law ([Rademacher 64], for computational complexity see also [Knuth 77]), which allows us to
calculate their values similar in spirit to the Euclidean algorithm. This implies that for a given t, N t (a, b, c) can be
computed with our rather simple algorithm in O(log(c))
time, assuming that c = max(a,
√ b, c). Hence if f (a, b, c)
is close to the lower bound 3abc—which, again, happens in the vast majority of cases—we obtain f (a, b, c)
in O(a log(c)) time. On the other hand,
√ we can of course
not assume that f (a, b, c) is close to 3abc; still we get, at
worst, a computation time of O(ab log(c)). What makes
1 Our
program can be downloaded at www.math.binghamton
.edu/matthias/frobcomp.html.
this analysis even more appealing is that it applies to the
general case of the Frobenius problem. As mentioned
above, there is an analog for (2–1) and (2–3) for d > 3
[Beck et al. 02], which again is a lattice-point count in a
polytope and as such is known (for fixed d) to be computable in O (p (log a1 , . . . , log ad )) time for some polynomial p [Barvinok 94]. With an analogous algorithm
for the general case, we would hence be able to compute
f (a1 , . . . , ad ) in O (a1 a2 p (log a1 , . . . , log ad )) time, where
a1 < a2 < · · · < ad . As in the three-variable case—
in fact, even more so—most Frobenius numbers will be
√
situated very close to the lower bound 3a1 a2 a3 , which
means that in the vast majority of cases, we can expect
a computation time of O (a1 p (log a1 , . . . , log ad )).
The computational complexity of the Frobenius problem is very interesting and still gives rise to ongoing studies. Davison [Davison 94] provided an algorithm for the
three-variable case (a < b < c) which runs in O(log b)
time. The general case is still open. While Kannan [Kannan 92] proved that there is a polynomial-time algorithm
(polynomial in log a1 , . . . , log ad ) to find g(a1 , . . . , ad ) for
fixed d, no such algorithm is known for d > 3. The
fastest general algorithm of which we are aware is due
to Nijenhuis [Nijenhuis 79] and runs in O(d a log a) time,
where a = min(a1 , . . . , ad ). Hence, while our primitive
algorithm is not competitive for the three-variable case
of the Frobenius problem, it might be worthwhile to develop it further in the general case.
We initially implemented our program as an MS-DOS
QUICK BASIC program and experienced some interesting problems due to floating-point errors: Computing
generalized Dedekind sums can get challenging for large
arguments. These problems were only discovered when
we reimplemented the algorithm in PARI-GP, which has
an extended precision arithmetic and also keeps track of
roundoff errors effectively. It is worth mentioning that
both Knuth’s algorithm [Knuth 77] for the computation
of Rademacher-Dedekind sums and Davison’s algorithm
[Davison 94] for computing g(a, b, c) are integer algorithms and therefore are very stable.
With our program, we generated at random 10000 admissible triplets. Our main question is the√relation of the
Frobenius number f = f (a, b, c) to z := abc. The following is a statistical description of the ratios R := f /z.
4.1 Descriptive Statistics
Q1 and Q3 are the first and third quartiles, respectively.
We see in Table 2 that 50% of the cases have a ratio
smaller than 2.01, and 75% have ratio smaller than 2.30.
Beck et al.: Some Experimental Results on the Frobenius Problem
a
487
229
223
244
509
262
475
248
265
274
368
281
315
305
393
313
301
655
296
359
337
320
335
379
b
733
483
307
357
541
349
611
305
488
401
415
341
488
319
452
532
479
671
731
520
346
469
668
389
c
738
662
698
619
557
699
679
439
509
695
599
502
559
652
619
579
725
679
749
619
701
491
669
748
f (a, b, c)
121755
64901
52657
56067
95788
61861
109183
45274
65434
70596
77374
57790
77734
67142
89830
84150
87903
150043
110834
94318
79559
77556
112894
97998
√
z = abc
16231.0
8557.0
6912.7
7343.0
12384.7
7994.7
14037.9
5762.5
8113.2
8738.6
9564.5
6935.6
9269.8
7964.7
10486.0
9819.0
10224.0
17274.9
12730.5
10749.6
9040.9
8584.2
12235.6
10501.4
√
3z
28112.9
14821.1
11973.2
12718.5
21450.9
13847.2
24314.4
9980.9
14052.5
15135.6
16566.2
12012.8
16055.8
13795.3
18162.3
17007.0
17708.5
29921.1
22049.9
18618.9
15659.3
14868.4
21192.6
18188.9
z 5/4
183202
82300
63032
67974
130649
75597
152802
50207
77000
84489
94586
63293
90958
75242
106112
97743
102808
198048
135225
109457
88159
82628
128685
106306
267
R = f /z
7.50140
7.58457
7.61740
7.63542
7.73439
7.73776
7.77773
7.85671
8.06514
8.07868
8.08972
8.33241
8.38571
8.42995
8.56664
8.57012
8.59773
8.68558
8.70618
8.77406
8.79989
9.03469
9.22672
9.33194
TABLE 1.
9.5
In the following figures, we present a box-plot and a histogram of the variable R.
8.5
7.5
TABLE 2.
6.5
R
Variable N Mean Median StDev Min Max Q1 Q3
R
10000 2.283 2.012 0.737 1.736 9.332 1.940 2.299
5.5
4.5
3.5
In the box-plot, the bottom line of the box corresponds
to the first quartile Q1 . The top line of the box corresponds to the third quartile Q3 . There are 980 points
above the value of R = 3. Only 24 points, which are
listed in Table 1, have a value of R greater than 7.5.
In Figure 3, we present all the points (z,√
f ). Notice
that all the points are above the straight line 3z, which
illustrates Davison’s lower bound. The upper bound is,
however, convex. It is included in the figure as the graph
z 5/4 .
5.
CONJECTURES AND CLOSING REMARKS
Randomly chosen admissible arguments tend to yield a
Frobenius number f smaller than the expected number
(mean) which is estimated to be 2.28z. The distribution
of R = f /z is very skewed (positive asymmetry) as seen
in Figure 1. Since 10000 random points yielded f <
√ 5/4
− a − b − c, the probability
z 5/4 , or g(a, b, c) < abc
2.5
1.5
FIGURE 1. Box-plot.
that √
a future randomly chosen admissible triplet with
z = abc < 20000 will yield f ≥ z 5/4 is smaller than
1/10000.
In general, our data suggests that one can obtain an
upper bound of smaller magnitude than what the above
cited results state. Again, the upper bounds in the literature are comparable to an upper bound proportional to
√ 4/3
abc . We believe the following is true.
Conjecture 5.1. √
There exists an upper bound for (a, b, c)
p
proportional to abc where p < 43 , valid for all admissible triplets (a, b, c).
268
Experimental Mathematics, Vol. 12 (2003), No. 3
4000
REFERENCES
3000
[Alfonsin 00] J. L. Ramirez Alfonsin. The Diophantine Frobenius Problem. Report No. 00893, Forschungsinstitut für
diskrete Mathematik, Universität Bonn, 2000.
1000
2000
[Barvinok 94] Alexander I. Barvinok. “Computing the
Ehrhart Polynomial of a Convex Lattice Polytope.” Discrete Comput. Geom. 12:1 (1994), 35–48.
0
[Beck et al. 02] Matthias Beck, Ricardo Diaz, and Sinai
Robins. “The Frobenius Problem, Rational Polytopes,
and Fourier–Dedekind Sums.” J. Number Theory 96:1
(2002), 1–21.
2
4
6
8
r
[Brauer 42] Alfred Brauer. “On a Problem of Partitions.”
Amer. J. Math. 64 (1942), 299–312.
FIGURE 2. Histogram
[Brauer and Shockley 62] Alfred Brauer and James E. Shockley. “On a Problem of Frobenius.” J. Reine Angew. Math.
211 (1962), 215–220.
[Davison 94] J. L. Davison. “On the Linear Diophantine
Problem of Frobenius.” J. Number Theory 48:3 (1994),
353–363.
[Erdős and Graham 72] P. Erdős and R. L. Graham. “On a
Linear Diophantine Problem of Frobenius.” Acta Arith.
21 (1972), 399–408.
[Johnson 60] S. M. Johnson. “A Linear Diophantine Problem.” Canad. J. Math. 12 (1960), 390–398.
FIGURE 3. f = f (a, b, c) as a function of z =
√
abc.
In fact, our data suggests, more precisely, that for all
admissible triplets (a, b, c),
g(a, b, c) ≤
√
5/4
abc
− a − b − c.
It is very improbable that a √
randomly chosen admissible triple (a, b, c), such that abc < 20000, will yield
√ 5/4
g(a, b, c) >
abc
− a − b − c. However, we remark that there might be specific structures of triples
(a, b, c), close to almost arithmetic, for which g(a, b, c) >
√ 5/4
abc − a − b − c. This is generally not the case.
ACKNOWLEDGMENTS
We would like to thank Tendai Chitewere for days and days
of computing time, Gary Greenfield for the nontrivial task
of converting our pictures into LATEX-friendly postscript, and
the referee and associate editor for helpful comments on the
first version of this paper. Finally, we would like to thank the
authors and maintainers of PARI-GP.
[Kannan 92] Ravi Kannan. “Lattice Translates of a Polytope
and the Frobenius Problem.” Combinatorica 12:2 (1992),
161–177.
[Knuth 77] D. E. Knuth. “Notes on Generalized Dedekind
Sums.” Acta Aritm. 33 (1977), 297–325.
[Lewin 75] Mordechai Lewin. “An Algorithm for a Solution
of a Problem of Frobenius.” J. Reine Angew. Math. 276
(1975), 68–82.
[Nijenhuis 79] Albert Nijenhuis. “A Minimal-Path Algorithm
for the ‘Money Changing Problem’.” Amer. Math.
Monthly 86:10 (1979), 832–835.
[Rademacher 64] H. Rademacher. “Some Remarks on Certain Generalized Dedekind Sums.” Acta Arith. 9 (1964),
97–105.
[Roberts 56] J. B. Roberts. “Note on Linear Forms.” Proc.
Amer. Math. Soc. 7 (1956), 465–469.
[Selmer 77] Ernst S. Selmer. “On the Linear Diophantine
Problem of Frobenius.” J. Reine Angew. Math. 293/294
(1977), 1–17.
Beck et al.: Some Experimental Results on the Frobenius Problem
[Sylvester 84] J. J. Sylvester. “Mathematical Questions with
Their Solutions.” Educational Times 41 (1884), 171–178.
269
[Vitek 75] Yehoshua Vitek. “Bounds for a Linear Diophantine Problem of Frobenius.” J. London Math. Soc. (2)
10 (1975), 79–85.
Matthias Beck, Mathematical Sciences Research Institute, 17 Gauss Way, Berkeley, CA 94720 (matthias@msri.org)
David Einstein, Structured Decisions Corp., 1105 Washington St., West Newton, MA 02465 (deinst@world.std.com)
Shelemyahu Zacks, Department of Mathematical Sciences, State University of New York, Binghamton, NY 13902-6000
(shelly@math.binghamton.edu)
Received March 28, 2001; accepted in revised form November 1, 2002.
Download