 A good student of mathematics can solve problems. A better student of mathematics can solve problems they created. Last time we showed that given any positive k, any sequence of more than k integers included consecutive terms whose sum was divisible by k. Could we make the sum equal to k? Well, let's see if it's possible. So let's consider a sequence of integers, and we'll ask under what conditions will there always be a sequence of consecutive terms whose sum is 17? So a useful strategy, try to avoid it. So one way of avoiding having a sum of consecutive terms equal to 17 is to have all of our terms bigger. And at the other end, if our sequence is all zeros, then no sum will equal 17. So to begin with, we'll assume that all terms are less than or equal to 17, but greater than zero. And it's probably worth taking care of the easy cases first if any term is 17 or done, unless you want to argue that a single term isn't a sequence of terms, but mathematicians don't distinguish between plural and singular, so get used to it, and it won't make a difference anyway. In any case, we'll assume that all of our terms are integers between 1 and 16. Now a useful strategy in math and in life, reduce, reuse, recycle. So we have looked at the partial sums before, so let's again consider our partial sums. If sum sum of consecutive terms is 17, then the difference between two partial sums must be 17 for sum i and j, since the difference will consist of the sum of the terms from a j plus 1 to a i. And so that says si is sj plus 17. This suggests that if we sort a list consisting of the si's and the si's plus 17 in a way that two of them end in the same bin, we're done. So remember the key to using the pigeonhole principle is to find the bins, so suppose we sort the partial sums by their actual values. Now in order to apply the pigeonhole principle, the number of values has to exceed the number of bins, and if our bins are the actual values, this means there has to be a maximum value for any of these partial sums. So remember, you can assume anything you want as long as you make it explicit. Since we need a maximum value for the partial sum, let's suppose no sum si exceeds 100, where we pick 100 because we like the number 100. If no sum exceeds 100, then no sum plus 17 exceeds 117. And so now we want to apply the pigeonhole principle. We have 117 bins, the possible sums, and the sum plus 17. And if we take the values from s1 through s59, and the same values plus 17, there's 59 times to 118 values in 117 bins, so two of the values have to be the same. Now remember the si's are the partial sums. So sj is the sum from 1 through j, and sj plus 1 is the sum from 1 through j plus 1. But we did assume that the ai's, the terms of our sequence, are all greater than 0. And this means that sj plus 1 must be greater than sj, and so our si's form a strictly increasing sequence. Now because it's a strictly increasing sequence, this also means the terms are distinct. So we might note the following, since no ai is 0, then the si's form strictly increasing sequence with distinct terms, so si is not equal to sj for any i or j. And likewise, the si plus 17s form a strictly increasing sequence with distinct terms, so si plus 17 is not equal to sj plus 17 for any i or j. And so si is sj plus 17 for some i and j, and consequently their difference is 17. I can't equal j, so either i is greater than j, or less than j. But if i is less than j, then si, which is the sum of the terms up to the ai terms, has fewer terms than sj, which will be the sum up to the i term and then onward to the j term. And since all the terms of the sequence are greater than 0, si would end up being less than sj, and consequently it could be less than sj plus 17, and they can't be equal. So i must be greater than j. And since i is greater than j, then i includes all the terms up to j and then some more. If we subtract sj, then we get, but since the difference is 17, the consecutive terms sum to 17, and we can summarize our specific result given a sequence of integers where every term is between 1 and 16, and no sum exceeds 100, then among the first 59 terms, there is a sequence of consecutive terms whose sum is 17. We can generalize this by altering the maximum sum to n and changing the desired sum to p, and this gives us, well, do your own homework.