- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
According to some notes, we can check if $N$ is composite as follows.
We consider a reasonably small prime $R$.
Instead of computing $(X+A)^N$ in order to check whether $(X+A)^N \mod{N}=(X^N+A) \mod{N}$ , we compute the remainder when $(X+A)^N$ is divided by $X^R-1$. That's done using the same method we learn in algebra class for dividing one polynomial by another. What's nice about the remainder is that it has only $R+1$ terms, as opposed to $N+1$ for the expansion of $(X+A)^N$. So if $R$ is small enough , we can actually compute the remainder - using the repeated squaring trick. It is obvious that the identity
$(X+A)^N \mod{(N,X^R-1)}=(X^N+A) \mod{(N,X^R-1)}$
is always true when $N$ is a prime.
If $N$ is composite , and if we choose the right value of $R$, then we need to try only a small number of $A$'s until we find one such that
$(X+A)^N \mod{(N, X^R-1)} \neq (X^N+A) \mod{(N, X^R-1)}$.
Once we find such an $A$, we have proved that $N$ is composite. There is a deterministic way to pick the $A$'s.First of all, why does the remainder of $(X+A)^N$ divided by $X^R-1$ have $R+1$ terms and not $R$ ?Secondly, how can we compute the remainder using the repeated squaring trick and without writing the expansion of $(X+A)^N$?
According to some notes, we can check if $N$ is composite as follows.
We consider a reasonably small prime $R$.
Instead of computing $(X+A)^N$ in order to check whether $(X+A)^N \mod{N}=(X^N+A) \mod{N}$ , we compute the remainder when $(X+A)^N$ is divided by $X^R-1$. That's done using the same method we learn in algebra class for dividing one polynomial by another. What's nice about the remainder is that it has only $R+1$ terms, as opposed to $N+1$ for the expansion of $(X+A)^N$. So if $R$ is small enough , we can actually compute the remainder - using the repeated squaring trick. It is obvious that the identity
$(X+A)^N \mod{(N,X^R-1)}=(X^N+A) \mod{(N,X^R-1)}$
is always true when $N$ is a prime.
If $N$ is composite , and if we choose the right value of $R$, then we need to try only a small number of $A$'s until we find one such that
$(X+A)^N \mod{(N, X^R-1)} \neq (X^N+A) \mod{(N, X^R-1)}$.
Once we find such an $A$, we have proved that $N$ is composite. There is a deterministic way to pick the $A$'s.First of all, why does the remainder of $(X+A)^N$ divided by $X^R-1$ have $R+1$ terms and not $R$ ?Secondly, how can we compute the remainder using the repeated squaring trick and without writing the expansion of $(X+A)^N$?