The partition function in arithmetic progressions