Oh, Charlie. You were so close to a complete analytical solution. Well, thanks for the excellent start. This will finish it, analytically
Note that
a mod p < p
a mod 2p < 2p
a mod 3p < 3p
a mod 4p < 4p
Therefore a+p < 10p
a < 9p
So there are only nine more cases to consider
a = 5p
a = 6p
a = 7p
a = 8p
4p < a < 5p
5p < a < 6p
6p < a < 7p
7p < a < 8p
8p < a < 9p
******************
a = 5p
0 + p + 2p + p = a+p
a = 3p, contradiction
******************
a = 6p
0 + 0 + 0 + 2p = a+p
a = p, contradiction
******************
a = 7p
p + p + p + 3p = a+p
a = 5p, contradiction
******************
a = 8p
0 + 0 + 2p + 0 = a+p
a = p, contradiction
******************
4p < a < 5p
(a-4p) + (a-4p) + (a-3p) + (a-4p) = a+p
a = p*(16/3), contradiction
******************
5p < a < 6p
(a-5p) + (a-4p) + (a-3p) + (a-4p) = a+p
a = p*(17/3)
gives solution of (17,3)
******************
6p < a < 7p
(a-6p) + (a-6p) + (a-6p) + (a-4p) = a+p
a = p*(23/3), contradiction
******************
7p < a < 8p
(a-7p) + (a-6p) + (a-6p) + (a-4p) = a+p
a = 8p, contradiction
******************
8p < a < 9p
(a-8p) + (a-8p) + (a-6p) + (a-8p) = a+p
a = p*(31/3), contradiction
SO, I HAVE PROVED THAT CHARLIE'S ANSWER IS COMPLETE. THERE ARE NO OTHER SATISFACTORY VALUES of a and p
Edited on December 29, 2012, 8:34 pm