# Determining if r is a Primitive Root of N

Suppose that we wanted to determine if 5 was a primitive root of 107? We would need to check all possible orders of 105 on 5, and if 106 was the smallest integer such that $5^{106} \equiv 1 \pmod {105}$, then we would know that 5 is in fact a primitive root (mod 107).

## Example 1

**Determine if 5 is a primitive root of 107.**

We first note that the possible order of 5 must be a positive divisor of 1 less than 107 (a divisor of 106). These divisors of 106 are 1, 2, 53, and 101.

Clearly 5 does not have order 1, since $5 \not \equiv 1 \pmod {107}$. Furthermore, 5 does not have order 2, since $5^2 = 25 \not \equiv 1 \pmod {107}$. We must now test to see if 5 has order 53. This can be done with successive squaring and multiplication:

(1)Hence, $5^{53} \equiv 106 \pmod {107}$. So 5 does NOT have order 53. Since 5 does not have order 1, 2, or 53, it goes that by Fermat's theorem that 5 has order 106. We can even verify this to be true since $5^{106} \equiv (106)^2 = 11236 \equiv 1 \pmod {107}$. Hence 5 is a primitive root of 107.

## Example 2

**Determine if 30 is a primitive root of 107.**

Once again, the possible orders of 30 (mod 107) are positive divisors of 106, namely 1, 2, 53, and 106. Clearly $30 \not \equiv 1 \pmod {107}$. We must now test to see if 30 has order 2:

(2)Hence 30 does not have order 2 (mod 107). We must now test to see if 30 has order 53, which can be done with successive squaring once again.

(3)Since $30^{53} \equiv 1 \pmod {107}$, then 30 has order 53 (mod 107). Hence 30 is NOT a primitive root of 107.

## Example 3

**Determine if 44 is a primitive root of 113.**

The divisors of 112 (and possible orders of 44) are 1, 2, 4, 7, 8, 14, 16, 28, 56, 112. There are a lot of orders to go through, though, we don't need to go through them all. We note that if the positive integer C is not the order of 44, then any divisor of C is also not the order of 44. We will strike off possible orders as we go along to proceed answering this question.

Firstly, the order of 44 is not 1, since $44 \not \equiv 1 \pmod {113}$. (1, 2, 4, 7, 8, 14, 16, 28, 56, 112). Now let's see if 56 is the order of 44 (mod 103). Once again, we will do this with successive squaring:

(4)We note that while we were successively squaring, we found that $44^8 \equiv 1 \pmod {113}$. Hence, we do not need to go further since 44 has order 8. 44 is NOT a primitive root of 113.

## Example 4

**Determine if 23 is a primitive root of 127.**

The possible orders of 23 are divisors of 126, namely 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, 63, 126. We will now test these powers to see if 127 is a primitive root.

(5)As we can see, the order of 23 is not 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, or 63. Hence by Fermat's theorem, it must be 126, as we show here:

(6)Hence 23 is a primitive root of 127.