I am studying fixed-point equations of the form $y^k = y$ ($k \in \mathbb{N}$) in $\mathbb{Z}_n$, aswhere here $\mathbb{Z}_n$ denotes the ring of $n$-adic integers (i.e., the projective limit $\varprojlim_k \frac{\mathbb{Z}}{n^k\mathbb{Z}}$). This is part of a cryptographic construction I am developing, whose behaviour depends on the $n$-adic fixed points that remain stable under the shift $k \mapsto k+2$.
In particular, I am interested in the smallest odd exponent $k$ for which $y^{k+2}=y$ already originates all the integer solutions of $y^{k}=y$ in $\mathbb{Z}_n$.
However, to avoid introducing unnecessary complications, I decided to focus on the equation $y^{2 \cdot n-1}=y$ for $n \geq 2$.
Accordingly, let $a(n)$ denote the number of $n$-adic integer solutions of
$y^{2 \cdot n-1}=y$ in $\mathbb{Z}_n$.
Now, by direct computation, I have obtained:
$$\begin{array}{c|cccccccccccccccc}
n & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 \\
a(n) & 3 & 3 & 3 & 5 & 9 & 7 & 3 & 3 & 15 & 11 & 9 & 13 & 6 & 14 & 3 & 17.
\end{array}
%a(2),a(3),\dots,a(17) = 3,3,3,5,9,7,3,3,15,11,9,13,6,14,3,17.
$$$$\begin{array}{c|cccccccccccccccc}
n & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 \\
a(n) & 3 & 3 & 3 & 5 & 9 & 7 & 3 & 3 & 15 & 11 & 9 & 13.
\end{array}
%a(2),a(3),\dots,a(13) = 3,3,3,5,9,7,3,3,15,11,9,13.
$$
For prime powers $n=p^m$ I already know that the number of solutions is the same as for $\mathbb{Z}_p$ (i.e., $a(p^m)=a(p)=p$ for odd primes $p$, and $a(2^m)=3$ starting from $y^3=y$).
For the simplest semiprime values of $n$ (namely $n=6$ and $n=10$) I have explicitly derived all the $9$ and $15$ solutions, respectively (including the trivial one $0$), but the computation becomes increasingly intricate as the number of prime factors of $n$ grows.
Now, I have the personal impression that reaching the exponent $k=\lambda(n)+1$ (where $\lambda$ denotes the Carmichael function) might already suffice to generate all the solutions of $y^k = y$ in $\mathbb{Z}_n$, although I have no proof of this heuristic conjecture (which trivially holds for every prime $n$ — since, for prime $n$, since in that case $\mathbb{Z}_n$ is a field$\lambda(n)=n-1$). I mention it only for context, not as a claim.
Question. Are the initial values above correct (fromin particular $a(12)$ onward)? More importantly, is there a known general formula or structural description for the number of solutions of $y^{2 \cdot n-1}=y$ in $\mathbb{Z}_n$ when $n$ has several distinct prime factors? Equivalently, how does one compute $a(n)$ for general composite $n$?
P.S.
Thanks to Chris Wuthrich's comment, we can now explicitly write the sequence $a(n)$, for $n = 2, 3, 4, \dotsc$, as follows: $3, 3, 3, 5, 9, 7, 3, 3, 15, 11, 9, 13, 21, 15, 3, 17, 9, 19, 15, 21, 33, 23, 9, 5, 39, 3, 21, 29, 45, 31, 3, 33, 51, 35, 9, 37, 57, 39, 15, 41, 63, 43, 33, 15, 69, 47, 9, 7, 15, 51, 39, 53, 9, 55, 21, 57, 87, 59, 45, 61, 93, 21, 3, 65, 99, 67, 51, 69, 105, 71, 9, 73, 111, 15, 57, 77, 117, 79, 15, 3, \dotsc$.