Enumeration Problems for a Linear Congruence Equation Wun-Seng Chou Institute of Mathematics Academia Sinica and Department of Mathematical Sciences National Chengchi University Taipei, Taiwan, ROC E-mail: macws@math.sinica.edu.tw Tian-Xiao He Department of Mathematics and Computer Science Illinois Wesleyan University Bloomington, IL 6702-2900, USA E-mail: the@iwu.edu Peter J.-S. Shiue Department of Mathematical Sciences University of Nevada, Las Vegas Las Vegas, NV 8954-4020, USA E-mail: shiue@unlv.nevada.edu Corresponding author. This work is partially supported by the National Science Council of Taiwan under the grant number NSC98-25-M-00-03. The author would like to thank the Department of Mathematical Sciences, University of Nevada at Las Vegas, for the hospitality. This work was partially done while the last two authors were visiting the Institute of Mathe-
Dedicated to Prof. Peter Bundschuh for the occasion of his 70th birthday. Abstract Let m 2 and r be integers and let c Z m {0,,..., m }. In this paper, we give an upper bound and a lower bound for the number of unordered solutions x,..., x n Z m of the congruence x + x 2 + + x r c mod m. Exact formulae are also given when m or r is prime. This solution number involves the Catalan number or generalized Catalan number in some special cases. Moreover, the enumeration problem has interrelationship with the restricted integer partition. Keywords: congruence, Catalan number, generalized Catalan number, integer partition Introduction Consider the congruence equation x + x 2 + + x n 0 mod n +, where n is a positive integer. It is well-known that the number of unordered solutions x, x 2,..., x n in Z n+ {0,,..., n} with repetition allowed is 2n n+ n Cn, the nth Catalan number see Guy [3] and Stanley [7]. In this paper, we consider the generalized congruence x + x 2 + + x r c mod m where m 2 and r are integers and c Z m {0,,..., m }. If x a,..., x r a r is a solution of, the multiset {a,..., a r } is called an unordered solution. If the multiset {a,..., a r } is actually a set, we call it an unordered solution without repetition. Note that each unordered solution represents several solutions because the coefficients of are all the same. Moreover, different unordered solutions represent different solutions. In Section 2, we deal with enumeration problems of both unordered solutions and unordered solutions without repetition. One of our results Theorem 4 involves the Catalan numbers and generalized Catalan numbers see Sands [6]. We give an interrelationship with the restricted integer partitions for our problems in Section 3. We give explicit closed forms for numbers of unordered solutions of with either prime m or prime r in Section 4. matics, Academia Sinica, Taiwan. They acknowledge the hospitality and financial support. 2
2 Unordered Solutions and Catalan Numbers Let M m,r be the set of all unordered solutions of with c ranging over all numbers in Z m. Every element of M m,r is a multiset containing r numbers in Z m and so, can be uniquely represented by a non-decreasing sequence of r elements in Z m, i.e., M m,r {{a a 2 a r } a,..., a r Z m }. Lemma Let m 2 and r be integers. Then m + r M m,r, r where the number on the right hand side is the usual binomial coefficient. Proof. This is trivial because M m,r is in fact the number of choices with repetition from the set Z m within r times. Let M m,r c be the set of all unordered solutions of. Trivially, M m, c for any 0 c < m. If c c 2, then M m,r c M m,r c 2. So, M m,r M m,r 0 M m,r m is a disjoint union. Lemma 2 Let m 2 and r be integers. For 0 c, c 2, if gcdm, r, c gcdm, r, c 2, then M m,r c M m,r c 2. Proof. Let c Z m and write e gcdm, r, c. For proving this lemma, it is enough to show M m,r c M m,r e. Since gcd m, r, c, there are integers x and y so that c + xr + ym p > m e e e e e e is a prime. So gcdm, p. Let 0 x 0, p 0 m satisfy x x 0 mod m and p p 0 mod m. Then gcdm, p 0 and c + x 0 r p 0 e mod m. Now, define f : M m,r c M m,r p 0 e by f{a,..., a r } {a + x 0,..., a r + x 0 } for all {a,..., a r } M m,r c. It is trivial that f is a bijection. So, M m,r c M m,r p 0 e. On the other hand, define a map g : M m,r e M m,r p 0 e by g{a,..., a r } {p 0 a,..., p 0 a r } for all {a,..., a r } M m,r e. Since gcdm, p 0, g is a bijection. This implies M m,r e M m,r p 0 e. Therefore, M m,r c M m,r e. The following result from this lemma is easy and so its proof is omitted. Corollary 3 Let m 2 and r be positive integers. If gcdm, r, then M m,r 0 M m,r m. 3
The last result cannot hold if m and r are not relatively prime. For instance, M 4,2 0 {{0, 0}, {, 3}, {2, 2}}, M 4,2 {{0, }, {2, 3}}, M 4,2 2 {{0, 2}, {, }, {3, 3}}, and M 4,2 3 {{0, 3}, {, 2}}, and so their cardinalities are not identical. The following result is easy to see from Corollary 3 and Lemma. Theorem 4 Let m 2 and r be positive integers. If gcdm, r, then for any integer 0 c < m, we have M m,r c m + r. m r Remark. The anonymous referee points out that Lemma 2 and Theorem 4 can also be proved by the cycle lemma, see Sands [6] for a combinatorial explanation of generalized Catalan numbers by using cycle lemma. Example. Take m n + and r n. Then M n+,n c n+ 2n n Cn is the number of unordered solution of x + + x n c mod n +. Similarly, if m n and r n +, we also have M n,n+ c 2n n n+ 2n n+ n Cn. The interested readers can refer to Stanley [7] and Stanley s website [8] for an extensive list of combinatorial interpretations of Catalan numbers. Furthermore, G. Birkhoff [2] asked in 934 whether or not B n 2n 2n n is an integer. Indeed, Bn C n is an integer for all positive integer n because we have 2n 2n n 2n n n. Example 2. Take m nk + and r n. We have M nk +,n c nk nk + n Cn,k, a generalized Catalan number. If m n and r k n +, then M n,k n+ c nk n nk + nk n n nk nk + n Cn,k. When considering unordered solutions without repetition instead of unordered solutions, we take r m. In the case r m, there is only one c say, c 0 if m is odd while c m if m is even so that has unordered solutions without repetition in 2 fact, there is only one unordered solution {0,,..., }. Let N m,r be the set of all unordered solutions of without repetition with c ranging over all numbers in Z m and let N m,r c be the set of all unordered solutions without repetition for any c in Z m. It is trivial that N m,r m r and Nm,r c0 N m,r c, a disjoint union. Note that Lemma 2 and Corollary 3 still hold. So, if gcdm, r, then N m,r c m m r. From m+r m+r m m+r m r, we have Nm+r,r a M m,r b with 0 a < m + r and 0 b < m, whenever gcdm, r. 4
Example 3. Take m 2n + and r n or n +. We have N m,r c 2n n+ n Cn. If m nk+ and r n, then N m,r c nk+ nk+ n C n,k. 2n+ 2n+ n nk nk + n Let m r and let M m,r c; j {{j a a 2 a r }} for 0 c, j < m. Then M m,r c j0 M m,rc; j, a disjoint union. It is trivial that M m,2 c; j if either c 2j or m+j > m+c 2j, and M m,2 c; j 0 otherwise. This terminology will be used in the proof of the following proposition, which gives a relation between M m,r c and N m,r c. Proposition 5 For integers m r > and any integer 0 c < m, r M m,r c r N m,r c + Proof. For 0 c < m, we have M m,r c + i 0 i 0 M m,r c; i k M m,r c i M m,r c i i 0 i i 2 i 2 i 2 i 3 0 Continuing this process, we finally have M m,r c i 0 M m,r c i + + r 2 + r i r 2 k N m,k c a M m,r k a. a0 i M m,r c i ; i 2 i i 2 0 i i i 2 0 M m,r 2 c i i 2 ; i 3. i r 2 i i 2 0 M m,r 2 c i i 2 i M m,r 2 c i i 2 i r 2 M m, c i i r i r 0 i r M m, c i r0 r i j ; i r 2 j 5
Let 0 < k < r. For a Z m, the total number of terms M m,r k a in the summation i k i k i k 0 M m,r k c i i k of 2, with a c i i k mod m, equals N m,k c a, the number of unordered solutions without repetition of x + x 2 + + x k c a mod m. So, i k i k i k 0 M m,r k c i i k a0 N m,kc a M m,r k a. Note that M m, c r j i j; i r if and only if c i i r i r mod m. So, the last term of 2 becomes i r 2 i r i r0 M m, c r j i j; i r N m,r c. Combining together, we get the result. Using this proposition, one can prove that r k0 k m m+r k k r k 0 for integers m r > 0. It seems that the expression for M m,r c is quite complicated in general. The only cases which we can give exact formulae for M m,r c are either m or r is prime. Those formulae will be given in the last section. Here we present a lower bound and an upper bound of M m,r c. Theorem 6 Let m, r 4 and 0 c < m be integers. Then m + r 2 r 3 2 m + r 2i m + 2 M m,rc +, m r r 2i + m 3 i where a denotes the least integer greater than or equal to a and a denotes the greatest integer less than or equal to a. Proof. Note that M m,r c; 0 M m,r c and M m,r c; i M m,r c i i j0 M m,r c i; j for r 2 and i < m. So, M m,r c i0 M m,r c i m + r 2 r i i i M m,r c i; j j0 i M m,r c i; j. j0 6
This implies m + r 2 M m,r c M m,r c i; 0 + M m,r c; 0 r i0 m + r 2 m + r 3 + M m,r 2 c r r 2 m + r 3 + M m,r 2 c. r The last inequality holds for all r > 3. Moreover, M m,i c M m,3 c m+2 m 3 see Theorem 8 in Section 4 for i, 2, 3. Iteratedly, we have an upper bound M m,r c r 3 2 m+r 2i i r 2i+ + m+2 m 3. Let M m,r c 0 be a largest one among all values M m,r c, 0 c < m. So, M m,r c 0 m+r 2 m r. For 0 c < m, define f : Mm,r c 0 M m,r c by f{y,..., y r } {c c 0, y,..., y r }. Then f is injective and so we get a lower bound M m,r c M m,r c 0 m+r 2 m r. 3 Interrelationship with the restricted integer partitions In this section, we are going to give two interrelationships with the restricted integer partitions for M m,r c. 3. First interrelationship For 0 c < m, M m,r c is the total number of integral solutions of equations x + x 2 + + x r km + c, 0 k < r, with 0 x x r m. 3 For 0 k < r, each unordered solution of 3 represents a restricted partition of km + c into at most r parts with each part m. For each non-negative integer n, let p,r n be the number of restricted partitions of n into at most r parts, each m, with the convention p,r 0. Let G,r x n0 p,rnx n be the generating function of restricted partitions of non-negative integers into at most 7
r parts with each part m. According to Theorem 3. in [], G,r x xm+r x r+. 4 x x Note that for 0 k < r, the number of solutions of x + x 2 + + x r km + c with 0 x x r m equals p,r km + c. From 3, r r [ M m,r c p,r km + c ] x km+c G,r x, 5 k0 where [ x l] G,r x is the coefficient of the term x l in G,r x. As an example, consider the case m 6 and r 3. Using 4, we have G 5,3 x x 8 x 7 x 6 x 5 x 4 / x 5 x 4 x 3 x 2 x x 5 +x 4 +2x 3 +3x 2 +4x +5x 0 +6x 9 +6x 8 +6x 7 +6x 6 +5x 5 +4x 4 +3x 3 +2x 2 +x+. By 5, we get M 6,3 0 2 k0 [x6k ]G 5,3 x + 6 + 3 0 6+2, M 6 3 6,3 2 k0 [x6k+ ]G 5,3 x 9 6+2, M 6 3 6,3 2 2 k0 [x6k+2 ]G 5,3 x 9 6+2, 6 3 M 6,3 3 2 k0 [x6k+3 ]G 5,3 x 0 6+2, M 6 3 6,3 4 k0 [x6k+4 ]G 5,3 x 9 6+2, and M 6 3 6,3 5 k0 [x6k+5 ]G 5,3 x 9 6+2. These are 6 3 consistent to the results computed by Theorem 8 in next section. Write y r x, y r x 2 x,..., y x r x r. Then 3 becomes k0 y + 2y 2 + + ry r km + c, 0 k < r, with y,..., y r 0 and y + + y r m. 6 Since the changing variable y r x, y r x 2 x,..., y x r x r is linear and non-singular, the total number of solutions y,..., y r of 6 is equal to M m,r c. Moreover, for 0 k < r, the equation y +2y 2 + +ry r km+c with y,..., y r 0 and y + +y r represents a restricted partition of km+c into at most parts with each part r. As in the last paragraph, let p r, n be the number of restricted partitions of n into at most parts, each part r, with the convention p r, 0, and let G r, x n0 p r,nx n be the generating function. According to Theorem 3. in [] again, we have G r, x xm+r x m. 7 x r x It is easy to see that G r, x G,r x. So, using 6 to compute M m,r c is the same as using 3 to compute M m,r c. 8
3.2 Second interrelationship Denote x r+ m and write y r+ x, y r x 2 x,..., y x r+ x r. Then 3 becomes y + 2y 2 + + r + y r+ km + c, k < r +, with y,..., y r+ 0 and y + + y r+ m. 8 For any integer l, n 0, let q r+ l, n be the number of restricted partitions of n into l parts, each part r +, with the convention q r+ l, 0 q r+ 0, n. Let H r+ y, z l0 n0 q r+l, ny l z n. Then H r+ y, z by formula 2.. in []. From 8, we have r+ i yz i 9 M m,r c r q r+ m, km + c k r [ y z km+c ] H r+ y, z. 0 k As an example, considering the case of m 2 and r 2l, we have 2l M 2,2l c k [ ] 2l+ yz 2k+c i { l +, c 0 yz i l, c. These results are consistent with the results obtained by Theorem 7 in next section. Note that even though we know the exact forms 7 and 9, it seems that there is no computationally closed form for either p r, km + c or q r+ m, km + c. So, it is not easy to get an exact form for M m,r c using either 5 or 0. However, there are algorithms to compute both p r, n and q r+ m, km + c see [4] and [5] for instance. One might employ those algorithms and either 5 or 0 to compute the number M m,r c. 4 Some special cases for M m,r c In this section, we compute M m,r c whenever either m or r is prime. 9
Theorem 7 Let m be a prime number. Then, for any positive integer r, { m+r M m,r c m r if c 0 mod m, m+r if c 0 mod m. m r Proof. If gcdm, r, the theorem holds by Theorem 4. So, we consider only that m and r are not relatively prime. Then, gcdm, r m and r m because m is prime. For any 0 c < m, M m,r c + i 0 i 0 M m,r c; i M m,r c i M m,r c i i 0 i i 2 i 2 i 2 i 3 0 Continuing this process, we finally have M m,r c i 0 M m,r c i + m 2 i m 2 i M m,r c i ; i 2 i i 2 0 i i i 2 0 M m,r 2 c i i 2 ; i 3. i i 2 0 M m,r 2 c i i 2 i M m,r 2 c i i 2 + + i m 2 M m,r m+ c i i i 0 + M m,r m+ c j j; 0 Write r tm. We show the result by induction on t. At first, let t. If m 2, the last term of is M m, c ; 0 if c, and M m, c ; 0 0 if c 0. So, the theorem holds. If m is an odd prime, the last term of becomes M m, c mm /2; 0 M m, c; 0 if c 0 and M m, c; 0 0 if c 0. Hence, the theorem also holds in this case. Finally, assume r tm with t > and that the theorem holds for r < tm. The last term of becomes M m,r m c mm /2. By the assumption of 0
induction, M m,r m 0 m/2 M m,r m c m/2 + for any c 0. By the assumption again, the theorem holds because of Theorem 4. Theorem 8 Let r 2 be a prime number. Then for integers m > and 0 c < m, { m+r M m,r c m r if c 0 mod r, m+r if c 0 mod r. m r Proof. If gcdm, r, the theorem holds by Theorem 4. So, let m lr for some positive integer l. If l, the theorem holds by Theorem 7. Hence, let l >. Since r is prime, gcdm, r, c is either or r for any integer 0 c < m. From Lemma 2, we only consider either c 0 or c. We are going to show M lr,r 0 M r,lr 0 and M lr,r M r,lr. Let G lr,r x and G r,lr x be generating functions, respectively, as those defined in the last section. Write G lr,r x lr r i0 a i x i and G r,lr x r lr i0 c i x i. Then we have M lr,r 0 r k0 a klr, M lr,r r k0 a klr+, M r,lr 0 lr k0 c kr, and M r,lr lr k0 c kr+ from 5. As in 4 and 7, G lr,r x x lr+r x lr / x r x and G r,lr x G lr,r x x lr+r x lr+ / x r x. These imply x r G lr,r x x lr G r,lr x lr 2 i0 b ix i. Multiplying out both sides of the first equality, we have r a i x i + i0 lr i0 c i x i + lr r ir lrr ilr a i a i r x i c i c i lr x i r lr 2 a lr 2r+i x lr r+i b i x i i lr i c lrr 2+i x lrr +i The first equality implies that a kr+j k i0 b ir+j for all 0 k lr and for all 0 j < r. Combining with the second equality, we have M lr,r 0 r k0 a klr r kl k0 i0 b ir rb 0 +r l i b ir + + r l ir 2l+ b ir r l i0 c ir M r,lr 0. Similarly, we have M lr,r M r,lr. Since r is prime, M r,lr 0 lr+r r lr and Mr,lr lr+r r lr by Theorem 7. From lr+r lr r lr+r r lr, we have Mlr,r 0 lr lr+r r and Mlr,r. This completes the proof. lr lr+r r i0
In general, the numbers M m,r c may not assume only two values as those in Theorems 7 and 8. For instance, M 4,4 0 0, M 4,4 M 4,4 3 8, and M 4,4 2 9, which means that M 4,4 c takes 3 values. On the other hand, M m,r c might takes two values even though gcdm, n. For instance, M 4,2 c has only values 3 and 2 as we have seen right after Corollary 3. Unfortunately, we are unable to give simple expressions as those stated in theorems above for arbitrary m and r. Acknowledgements: We would like to thank Professor Zhi-Wei Sun, Nanjing University, PRC, for his data support of Theorem 8. Authors would like to express their gratitude to the anonymous referee for his/her helpfull comments and remarks that led to an improved/revised version of the original manuscript. References [] G. E. Andrews, The Theory of Partitions, Encyclo. Math. Its Appls. vol. 2, Addison-Wesley, Reading, Mass.-London-Amsterdam, 976. [2] G. Birkhoff, Problem 3674, Amer. Math. Monthly 4 934, 269. [3] R. K. Guy, Parker s permutation problem involves the Catalan numbers, Amer. Math. Monthly 00 March, 993, 287 289. [4] J. D. Opdyke, A unified approach to algorithms generating unrestricted and restricted integer compositions and intefer partitions, J. Math. Model Algor. 9 200, 53 97. [5] L. A. Sanchis and M. B. Squire, Parallel algorithms for counting and randomly generating integer partitions, J. Paral. Distrib. Computing 34 996, 29 35. [6] A. D. Sands, On generalized Catalan numbers, Discrete Math. 2 978, 29 22. [7] R. P. Stanley, Enumerative Combinatorics, vol. 2, Cambridge Stud. Adv. Math. vol. 62, Cambridge Univ. Press, Camabridge, 998. [8] R. P. Stanley, Catalan Addendum, http://www.math.mit.edu/rstan/ec/catadd.pdf. 2