In class today, the prof explained Pepin's test, but I got lost midway. This is what I have so far:

Let , then Call this number .

If (1), then . Because of (1), 2q is the order. What I don't understand is how this shows that is prime. I also don't get how .

Any help is much appreciated.