Your $p_j$ doesn't make sense because you don't have $j$ anywhere else. But you're close. Suppose your numbers are $p_1, p_2, \ldots, p_N$. Then the expression you want is
$\sum_{i=1}^{N-1} p_{i} - p_{i+1} $
Here if $p_i$ is one of the numbers in the sequence, then $p_{i+1}$ is the next number. So it says that from each number $p_i$, we subtract the next number $p_{i+1}$, and then the $\sum$ says to add up all the differences.
Note that we add only up to $i=N-1$, since after that there is no next number to subtract from: when $i=N-1$, the $p_{i}-p_{i+1}$ expression becomes $p_{N-1} - p_{N}$, and we are subtracting the ḷast number from the next-to-last one.
As Chris Eagle noted, the sum "telescopes" and simplifies to $p_1 - p_N,$ so you could also write it that way, but that represents a different (and simpler) calculation that happens to always produce the same result.