Let $p$ be a prime number and $P=\{1,2,...,p-1\}$

In how many ways we can sum *all* the elements of $P$ in such a way that we will reach a multiple of $p$

only when we sum the last summand?

For example let $p=7$ .

Clearly, $1+2+3+4+5+6$ is such a sum (In fact there exist $408$ such sums)

but $2+3+5+4+1+6$ is not, because already $2+3+5+4=2\cdot7$.

We can see after a little investigation that if the total number of sums is $f(p)$,then

$\frac{(p-1)!}{p-2}\leq f(p)\leq (p-1)!$ (equality holds iff $p=3$)

Is it possible to improve this (to find asymptotic bounds or -even better- something precise)?

Thanks in advance!

**EDIT** : It is possible to prove in an elementary way that for every $n\in \mathbb{N}$, $\phi(n)\mid f(n)$

($\phi(n)$ is Euler's function)

9more comments