If $p$ is a prime prove that, $(p-1)!+1$ is a power of $p$ iff $p=2,3,5$.
I proceeded by assuming that $(p-1)!+1$ is a power of $p.$ So, $(p-1)!+1=p^k,$ $k\in\Bbb Z$. This implies $p^k-1=(p-1)!$ and on cancelling both sides by $(p-1)$ we have, $$p^{k-1}+p^{k-2}+...+1=(p-2)!.$$ Now, I tried checking modulus $p-1$ on the L.H.S and R.H.S of this equality. My logic was, if $p$ is an odd prime, then, $p-1$ is even and so, as, $p-1|(p-2)!.$ This further means that $p-1|p^k-1.$ But $p^{k-1}\equiv 1\pmod {p-1},p^{k-2}\equiv 1\pmod {p-1},\cdots,1\equiv 1\pmod {p-1}$ and adding all these we have, $$p^{k-1}+p^{k-2}+...+1\equiv k\pmod {p-1}.$$ But then, $k$ has to be zero. If $k=0$ then, $(p-1)!+1=1$ then, $(p-1)!=0$ and this is never possible. But in our calculations, one cricial step was assuming $p\neq 2$ so, $p=2$ must be verified and it indeed satisfies the criterias.
I know that $p=3,5$ also satisfies the required criterias but I don't know why my line of reasoning eliminates them as probable candidates. Where is the flaw in my arguments?
The fallacy is in the use of the lemma that $n|(n-1)!$ when $n$ is composite. This is true only when $n\gt 4.$ So, the essential assumption that you are using here is $p\gt 5.$ So, yes, the proof essebtially handles the cases for all odd primes greater than $5.$ But, it does NOT attempt to investigative for those primes $p=2,3$ or $5.$ So, all in all, your proof never actually eliminated any candidates but rather reinforced it.