Primality has nothing to do with it.
Replace $p$ by $x$, where $x$ is an integer, $x >1$.
Claim: $\text{RHS} - \text{LHS} = 1$ if and only if $x \equiv 2 \pmod 3$, and equals $0$ otherwise.
To prove it, write $x = 6k + r$, where $k,r$ are nonnegative integers and $0 \le r < 6$.
Then consider cases based on the value of $r$. For each $r$, compute the $\text{RHS}$ and $\text{LHS}$ exactly in terms of $k$ (for each fixed value of $r$, the floors and ceilings can be simplified), and observe that the claim stated above holds.
For the case where $x$ is prime, it follows that $\text{RHS} - \text{LHS} = 1$ if and only if $x = 2$ or $x = 5 \pmod 6$, which is consistent with what you found experimentally.