I have a type of expression for a sum of distances between particles, which is as follows for four particles $$ d_{12} + d_{13} + d_{14} + d_{23}+d_{24} + d_{34}, $$ where $d_{12}$ is the distance between particles $1$ and $2$.
I am trying to write this in double summation notation. I checked some online notes on classical mechanics and it suggested for $N$ particles one should have $$ \sum_{i=1}^N \sum_{j \neq i} d_{ij}, $$ but when I expand this I get $$ d_{12} + d_{13} + d_{14} + d_{21} + d_{23} + d_{24} + d_{31} + d_{32} + d_{34} + d_{41} + d_{42} + d_{43}. $$
Can someone explain how my expression should actually be written concisely with a sum and index notation? So you only have distance between particle $1$ and all the other $N-1$ particles, then next step you only have distance between particle $2$ and the other particles apart from particle $1$, and so on.
Edit: I just realised that $$ \sum_{i=1}^N \sum_{j>i} d_{ij} $$ would work instead, but might have to be careful specifying if we run over $N$ or $N-1$ and what the index set runs over.