Let's assume $n$ doesn't pass the Miller-Rabin test and $b$ is a witness. Meaning, $b^{\frac{n-1}{2^r}} \equiv 1 \pmod{n}$ where $\frac{n-1}{2^r}$ is even, but $c = b^{\frac{n-1}{2^{r+1}}} \not\equiv \pm1 \pmod{n}$. Show that $\gcd(c+1,n),\gcd(c-1, n)$ are non-trivial divisors of $n$.
So first of all, for my convenience:
- Denote $n-1 = 2^ls$, $s$ is odd.
- Denote $k=l-r$.
- $c = b^{2^{k-1}s}$
- $c^2 = b^{2^{k}s}$
- $2^ks$ is even
It is given that $c^2 \equiv 1 \pmod{n} \implies (c-1)(c+1) \equiv 0 \pmod {n} \implies n\mid (c-1)(c+1)$
Now, I think we can assume that $n$ passed Fermat's theorem test (that's part of the initial tests of the Miller-Rabin algorithm).
Hence,
$$c^{r+1} = b^{2^l s} = b^{n-1} \equiv 1 \pmod {n}$$
but that isn't revealing anything new other than $r$ is odd (since $2$ must divide $r+1$).
What am I missing?