3rd APMO 1991 Problem 4 A sequence of values in the range 0, 1, 2, ... , k-1 is defined as follows: a 1 = 1, a n = a n-1 + n (mod k). For which k does the sequence assume all k possible values?
Let f(n) = n(n+1)/2, so a n = f(n) mod k. If k is odd, then f(n+k) = f(n) mod k, so the sequence can only assume all possible values if a 1 , ... , a k are all distinct. But f(k-n) = f(n) mod k, so there are at most (k+1)/2 distinct values. Thus k odd does not work. If k is even, then f(n+2k) = f(n) mod k, so we need only look at the first 2k values. But f((2k-1-n) = f(n) mod k and f(2k-1) = 0 mod k, so the sequence assumes all values iff a 1 , a 2 , ... , a k-1 assume all the values 1, 2, ... , k-1. Checking the first few, we find k = 2, 4, 8, 16 work and k = 6, 10, 12, 14 do not. So this suggests that k must be a power of 2. Suppose k is a power of 2. If f(r) = f(s) mod k for some 0 < r, s < k, then (r - s)(r + s + 1) = 0 mod k. But each factor is < k, so neither can be divisible by k. Hence both must be even. But that is impossible (because their sum is 2r+1 which is odd), so each of f(1), f(2), ... , f(k-1) must be distinct residues mod k. Obviously none can be 0 mod k (since 2k cannot divide r(r+1) for 0 < r < k and so k cannot divide f(r) ). Thus they must include all the residues 1, 2, ... k-1. So k a power of 2 does work. Now suppose h divides k and k works. If f(n) = a mod k, then f(n) = a mod h, so h must also work. Since odd numbers do not work, that implies that k cannot have any odd factors. So if k works it must be a power of 2. 3rd APMO 1991 © John Scholes jscholes@kalva.demon.co.uk 11 Apr 2002