If the values are distinct, then each of 1, 2, ..., p-1 appears once, so their sum is (p^{2}-p)/2. If p = 2, then p - 1 = 1 which divides p, so the first case applies. So, p\geq3. Then, p must be odd, so p-1 is even, and (p-1)/2 is an integer. Therefore, (p^{2}-p)/2 = p(p-1)/2 = p*n for some n...