I have a homework problem that I've attempted for days in vain... It's asking me to find an $n$ so that there is exactly one element of the complete residue system $\pmod n$ that is its own inverse apart from $1$ and $n-1$. It also asks me to construct an infinite sequence of $n's$ so that the complete residue system $\pmod n$ has elements that are their own inverses apart from $1$ and $n-1$.
For the first part, I tried all $n$ from $3$ up to $40$, but none worked... For the second part, I'm really confused...
Could someone please help me with this? Thanks!