Disclaimer: The solutions we've shared are just one exciting approach, and
there are surely many other wonderful methods out there. We’d love to hear
your alternative solutions in the community thread below, so let's keep the
creativity
flowing!
Let $A_i$ be the set of divisors of $ip+1$ which are not less than $i$ and less than $p$.
We will prove that $A_i$ are disjoint and $A_1\cup A_2\cup A_3...\cup A_{p-1} = \{1,2,3...,p-1\}$
Step 1:
proof that $A_i$ and $A_j$ are disjoint for all pairs $i,j<p$
For the sake of contradiction, assume that there is a term, say $c$ for which, $c\in A_i$ and $c\in A_j$.
So, $i\leq c<p$ and $j\leq c<p$
Also, $ip+1\equiv jp+1\equiv 0 \pmod c \implies (i-j)p\equiv 0\pmod c$
So, $c\mid p(i-j)$. But, $c<p \implies \gcd(c,p)=1$.
So, $c\mid i-j$
Again, $i,j\leq a$ and $i\neq j$. So, $|i-j| < c$
So, $c\nmid i-j$. Contradiction.
Step 2:
proof that for all $c<p$, there is a $i<p$ with $c\in A_i$.
For the sake of contradiction, assume that there is no such $i$.
So, $c\nmid ip+1$ for all $i\leq c$
Using php, we have $j\neq k$ such that $jp+1\equiv kp+1 \pmod c$
$\implies (j-k)p\equiv 0 \pmod{c}$
In the same way as the first part, this can be contradicted.
So, for all $c$, there is an unique $i<p$ with $c\in A_i$.
So, $A_1\cup A_2\cup A_3...\cup A_{p-1} = \{1,2,3...,p-1\}$
So, $a_1+a_2+a_3+...+a_{p-1} = |\{1,2,3...,p-1\}|=p-1$.
The answer is $p-1$.