Let k be a positive integer. Suppose that the integers 1, 2, 3, ...3k, 3k + 1 are written down in random order.
What is the probability that at no time during this process, the sum of the integers that have been written up to that time is divisible by 3?
Source: Putnam competition
The first integer must be congruent to 1 or 2 mod 3. After that subsequent integers must be either a multiple of 3 or congruent to the running sum mod 3. The next number which is 1 or 2 mod 3 must be the same parity as the first number, then all subsequent numbers 1 or 2 mod 3 strictly alternate 1 mod 3 and 2 mod 3.
If the first number is 1 mod 3 then the sequence will always have 1 or 2 more numbers of that form more than those of 2 mod 3, and vice versa. Because there are k+1 numbers 1 mod 3 and only k numbers 2 mod 3, the first number must be 1 mod 3.
The multiples of three can occur anywhere except the first number, then there are ((3k)!)P(k!) = (3k)!/(2k)! ways out of (3k+1)! to choose how to put the multiples of 3 in the sequence. There are (k+1)! ways to place the 1 mod 3 numbers and k! ways to place the 2 mod 3 numbers.
Then in total there are k!*(k+1)!*(3k)!/(2k)! ways to create a desires sequence out of all (3k+1)! possible sequences. Then the probability is ((k+1)!*(3k)!/((2k)!)) / ((3k+1)!) = (k!*(k+1)!)/((2k)!*(3k+1))
Edited to fix mistake found by Charlie.
Edited on March 17, 2016, 11:34 pm