Browse · MathNet
PrintRomanian Master of Mathematics
Romania number theory
Problem
Consider an odd prime and a positive integer . Let be a list of positive integers less than such that any specific value occurs at most times and is not divisible by . Prove that there exists a permutation of the such that, for all , the sum is not divisible by .
Solution
Lemma. Let be a positive integer and let be a list of positive integers less than such that each specific value occurs at most times. Fix a residue . Then there exists a permutation of the such that for all . Proof. Induct on . The base case, , is clear, so let . Consider the residue that occurs the most times amongst the .
If , set and complete the rest of the list using the inductive hypothesis with replaced by , as any residue will occur amongst the remaining at most times. Indeed, if no other residue occurs as many times as , then the number of occurrences of any residue amongst the remaining is at most . Otherwise, if there is another residue that occurs as many times as , their number of occurrences has to be at most .
If , choose a residue amongst the ; the choice is possible, as . Set and , noting that . If no other residue occurs as many times as , then each residue occurs amongst the remaining at most times. If occurs at most times, then clearly the same will hold for any residue in the remaining . The remaining possibility is that and another residue both occur times and is even, meaning that the other residue has to be , and there are no other residues; it is clear that the occurrences in the remaining are precisely . The inductive hypothesis then applies with replaced by to complete the list. This establishes the lemma.
Back to the problem, if each residue occurs at most times, the conclusion follows by the Lemma.
Otherwise, there is exactly one residue that occurs times amongst the . Note that , to set , . Letting , note also that , so none of the first partial sums is divisible by , as is prime.
To complete the proof, apply the Lemma with to the remaining . There are left such, occurs times amongst these and any other residue occurs at most times, both of which do not exceed .
Alternative solution. The permutation will be constructed step by step, first choosing , then , and so on. At every step, sort the remaining values by their number of appearances from most frequent to least frequent, and from largest to smallest for the situations where the number of appearances is the same. After that, attempt to select the first value from the sorted list; if this results in a partial sum that is divisible by , then attempt to select the second value from the list, which will result in a partial sum that is not divisible by as the first and second values are different modulo . Label the step as type (I) if the first value has been selected and as type (II) if the second value has been selected.
Lemma. Any step of type (II) is followed by a step of type (I).
Proof. Suppose that step is of type (II). Denote the first two values according to the sorting order with and , and let be the partial sum until this step. Since step is type (II), . At step , the first value according to the sorting order will still be . Since , can be selected for step , so step is of type (I).
Now suppose, for the sake of contradiction, that this procedure fails. Let be the first step when neither (I) nor (II) is possible. In particular, this means that there is a single value remaining, and it occurs times. Let be the smallest number with the following property: at every step between and , the value is the first one according to the sorting order; in particular, is the most frequently occurring one. Such a exists because satisfies this property.
If , then at step there is another value that comes before in the sorted order. Suppose that at step there are values of remaining; then there are at least values of remaining. According to the lemma, at least half of the steps are of type (I), which means that is selected in them. Denote , then has been selected at least steps between and . Since at step , there are values of remaining, it means that . At the same time, at step there are no values of remaining, so between steps and all the remaining values have been selected, and this can happen at most times. Combining these two leads to , or , a contradiction.
If , then is always the first in the sorted order. Therefore, the first steps are of type (I), and step is of type (II). If , from steps to , at least every other step is of type (I), meaning that is selected. Once step is done, there are remaining values of . Therefore, in the beginning, there were at least values of , contradiction. In the situation when , there are at least values of , which is also a contradiction.
If , set and complete the rest of the list using the inductive hypothesis with replaced by , as any residue will occur amongst the remaining at most times. Indeed, if no other residue occurs as many times as , then the number of occurrences of any residue amongst the remaining is at most . Otherwise, if there is another residue that occurs as many times as , their number of occurrences has to be at most .
If , choose a residue amongst the ; the choice is possible, as . Set and , noting that . If no other residue occurs as many times as , then each residue occurs amongst the remaining at most times. If occurs at most times, then clearly the same will hold for any residue in the remaining . The remaining possibility is that and another residue both occur times and is even, meaning that the other residue has to be , and there are no other residues; it is clear that the occurrences in the remaining are precisely . The inductive hypothesis then applies with replaced by to complete the list. This establishes the lemma.
Back to the problem, if each residue occurs at most times, the conclusion follows by the Lemma.
Otherwise, there is exactly one residue that occurs times amongst the . Note that , to set , . Letting , note also that , so none of the first partial sums is divisible by , as is prime.
To complete the proof, apply the Lemma with to the remaining . There are left such, occurs times amongst these and any other residue occurs at most times, both of which do not exceed .
Alternative solution. The permutation will be constructed step by step, first choosing , then , and so on. At every step, sort the remaining values by their number of appearances from most frequent to least frequent, and from largest to smallest for the situations where the number of appearances is the same. After that, attempt to select the first value from the sorted list; if this results in a partial sum that is divisible by , then attempt to select the second value from the list, which will result in a partial sum that is not divisible by as the first and second values are different modulo . Label the step as type (I) if the first value has been selected and as type (II) if the second value has been selected.
Lemma. Any step of type (II) is followed by a step of type (I).
Proof. Suppose that step is of type (II). Denote the first two values according to the sorting order with and , and let be the partial sum until this step. Since step is type (II), . At step , the first value according to the sorting order will still be . Since , can be selected for step , so step is of type (I).
Now suppose, for the sake of contradiction, that this procedure fails. Let be the first step when neither (I) nor (II) is possible. In particular, this means that there is a single value remaining, and it occurs times. Let be the smallest number with the following property: at every step between and , the value is the first one according to the sorting order; in particular, is the most frequently occurring one. Such a exists because satisfies this property.
If , then at step there is another value that comes before in the sorted order. Suppose that at step there are values of remaining; then there are at least values of remaining. According to the lemma, at least half of the steps are of type (I), which means that is selected in them. Denote , then has been selected at least steps between and . Since at step , there are values of remaining, it means that . At the same time, at step there are no values of remaining, so between steps and all the remaining values have been selected, and this can happen at most times. Combining these two leads to , or , a contradiction.
If , then is always the first in the sorted order. Therefore, the first steps are of type (I), and step is of type (II). If , from steps to , at least every other step is of type (I), meaning that is selected. Once step is done, there are remaining values of . Therefore, in the beginning, there were at least values of , contradiction. In the situation when , there are at least values of , which is also a contradiction.
Techniques
Modular ArithmeticInduction / smoothingGames / greedy algorithms