TITLE: The sum of all integers from $1$ to $p$ is divisible by $p$ and all prime numbers before $p$. What can $p$ be?
QUESTION [5 upvotes]: The summation of all integers from $1$ to $p$ is divisible by $p$ and all prime numbers before $p$. Find all possible solutions for $p$, with proof. Here $p$ is a prime number.   

This is a preparation problem for the upcoming BdMO. I can't find a way to start. Any hint will be helpful.

REPLY [2 votes]: The obvious way to start would be to check the results for a few small numbers and review the patterns discovered.
For any odd prime $p$ the sum of numbers $s$ from $1$ to $p$ is divisible by $p$ : $s=\frac 12 p(p+1)$ and $2\nmid p$ (or for a more intuitive reason, you can form the numbers below $p$ in separate pairs that sum to $p$). By examination we can see that $2 \nmid (1+2)$.
Looking at this sum, it is clear that all the primes below $p$ need to divide $\frac{p+1}{2}$. However for primes $7$ and greater, the product of all the smaller primes is greater than the prime concerned, so we only need to consider $p=3$ and $p=5$. For $p=5$, $\frac{p+1}{2}$ is odd so this is eliminated and only $p=3$ fits the criteria.