MAS114: Lecture 17 - University of...

51
MAS114: Lecture 17 James Cranch http://cranch.staff.shef.ac.uk/mas114/ 2017–2018

Transcript of MAS114: Lecture 17 - University of...

MAS114: Lecture 17

James Cranch

http://cranch.staff.shef.ac.uk/mas114/

2017–2018

An early Christmas present

I’ve put online my number theory tool, to help you revise.http://cranch.staff.shef.ac.uk/ntaas/

It’s linked from the main course webpage.

An early Christmas present

I’ve put online my number theory tool, to help you revise.

http://cranch.staff.shef.ac.uk/ntaas/

It’s linked from the main course webpage.

An early Christmas present

I’ve put online my number theory tool, to help you revise.http://cranch.staff.shef.ac.uk/ntaas/

It’s linked from the main course webpage.

An early Christmas present

I’ve put online my number theory tool, to help you revise.http://cranch.staff.shef.ac.uk/ntaas/

It’s linked from the main course webpage.

A remark

RemarkFermat’s Little Theorem should not be confused with Fermat’s LastTheorem. The latter says there are no solutions in positive integersto an ` bn “ cn with n ě 3, and was much, much harder to prove.

A remark

RemarkFermat’s Little Theorem should not be confused with Fermat’s LastTheorem.

The latter says there are no solutions in positive integersto an ` bn “ cn with n ě 3, and was much, much harder to prove.

A remark

RemarkFermat’s Little Theorem should not be confused with Fermat’s LastTheorem. The latter says there are no solutions in positive integersto an ` bn “ cn with n ě 3

, and was much, much harder to prove.

A remark

RemarkFermat’s Little Theorem should not be confused with Fermat’s LastTheorem. The latter says there are no solutions in positive integersto an ` bn “ cn with n ě 3, and was much, much harder to prove.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together.

It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated.

First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime

, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).

For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2

, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

More generality

In the proof of Fermat’s Little Theorem, we multiplied onerepresentative of each invertible residue class together. It turns outwe can prove a substantially more general theorem, but it’s a littlemore complicated. First we need a definition:

DefinitionEuler’s function (sometimes known as the totient functionϕ : NÑ N is defined by taking ϕpnq to be the number of integersbetween 1 and n (inclusive) which are coprime to n.

For example, ϕppq “ p ´ 1 if p is prime, since every number from1 to p ´ 1 is coprime to p (and p isn’t coprime to p).For another example, ϕp6q “ 2, since 1 and 5 are the only numbersbetween 1 and 6 which are coprime to 6.

Fermat-Euler

Using this concept, we can generalise Fermat’s Little Theoremconsiderably:

Theorem (Fermat-Euler Theorem)

Let a and n be integers with gcdpa, nq “ 1. Then

aϕpnq ” 1 pmod nq.

Proof.

?

Fermat-Euler

Using this concept, we can generalise Fermat’s Little Theoremconsiderably:

Theorem (Fermat-Euler Theorem)

Let a and n be integers with gcdpa, nq “ 1. Then

aϕpnq ” 1 pmod nq.

Proof.

?

Fermat-Euler

Using this concept, we can generalise Fermat’s Little Theoremconsiderably:

Theorem (Fermat-Euler Theorem)

Let a and n be integers with gcdpa, nq “ 1. Then

aϕpnq ” 1 pmod nq.

Proof.

?

Fermat-Euler

Using this concept, we can generalise Fermat’s Little Theoremconsiderably:

Theorem (Fermat-Euler Theorem)

Let a and n be integers with gcdpa, nq “ 1. Then

aϕpnq ” 1 pmod nq.

Proof.

?

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it.

It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.

However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq

, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq.

In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.

But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1

(in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq)

, orp | a` 1 (in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1

(in which case a ” ´1 pmod pq).

Squaring mod p

We worked with the factorial in the proof of Fermat’s LittleTheorem without ever needing to calculate it. It turns out we cancalculate it, using a clever trick.However, we’ll need a fact first:

Proposition

Let p be a prime, and let a be an integer with the property thata2 ” 1 pmod pq. Then either a ” 1 pmod pq or a ” ´1 pmod pq.

Proof.If a2 ” 1 pmod pq, then a2 ´ 1 ” 0 pmod pq, ie pa´ 1qpa` 1q ” 0pmod pq. In other words, p | pa´ 1qpa` 1q.But then, either p | a´ 1 (in which case a ” 1 pmod pq), orp | a` 1 (in which case a ” ´1 pmod pq).

A comment

RemarkThis theorem is not true for some composite moduli! For example,12 ” 32 ” 52 ” 72 ” 1 pmod 8q.I regard this as more evidence that prime moduli behave verynicely indeed!

A comment

RemarkThis theorem is not true for some composite moduli!

For example,12 ” 32 ” 52 ” 72 ” 1 pmod 8q.I regard this as more evidence that prime moduli behave verynicely indeed!

A comment

RemarkThis theorem is not true for some composite moduli! For example,12 ” 32 ” 52 ” 72 ” 1 pmod 8q.

I regard this as more evidence that prime moduli behave verynicely indeed!

A comment

RemarkThis theorem is not true for some composite moduli! For example,12 ” 32 ” 52 ” 72 ” 1 pmod 8q.I regard this as more evidence that prime moduli behave verynicely indeed!

Wilson’s Theorem

Now, this allows us to do this:

Theorem (Wilson’s Theorem)

We have pn ´ 1q! ” ´1 pmod nq if and only if n is prime.

Proof.

?

Wilson’s Theorem

Now, this allows us to do this:

Theorem (Wilson’s Theorem)

We have pn ´ 1q! ” ´1 pmod nq if and only if n is prime.

Proof.

?

Wilson’s Theorem

Now, this allows us to do this:

Theorem (Wilson’s Theorem)

We have pn ´ 1q! ” ´1 pmod nq if and only if n is prime.

Proof.

?

Wilson’s Theorem

Now, this allows us to do this:

Theorem (Wilson’s Theorem)

We have pn ´ 1q! ” ´1 pmod nq if and only if n is prime.

Proof.

?

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.

As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.

But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.

Examples and remarks

Here’s an example or two:

§ 4 is composite, and p4´ 1q! “ 3! “ 6 ” 2 pmod 4q.

§ 5 is prime, and p5´ 1q! “ 4! “ 24 ” ´1 pmod 5q.

§ 6 is composite, and p6´ 1q! “ 5! “ 120 ” 0 pmod 6q.

§ 7 is prime, and p7´ 1q! “ 6! “ 720 ” ´1 pmod 7q.

RemarkYou could use this as a way of testing if a number is prime.As a matter of fact, it’s not a good way of doing it: if we want tocheck a large number N, it’s quicker to do trial division to see if Nhas any factors, than it is to multiply lots of numbers together.But this result was psychologically important in the developmentof modern fast primality tests: it was the first evidence that thereare ways of investigating whether a number N is prime or not bylooking at how arithmetic modulo N behaves.