IB HL Mathematical
Exploration
Exploring Properties of Prime Numbers
through Congruence and Theorems
Personal code: kzr920
Table of contents
INTRODUCTION............................................................................................2
Prime numbers..........................................................................................2
Congruence and its property.....................................................................4
DISCUSSION.................................................................................................6
Fermat’s Little Theorem.........................................................................6
Wilson’s Theorem...................................................................................6
Euler’s Totient Function and Euler’s Totient Theorem.............................7
Fermat’s 4n+1 Theorem and Fermat’s Numbers...................................8
Dirichlet’s Theorem................................................................................9
Chebyshev’s Theorem..........................................................................10
Mersenne Numbers..............................................................................10
Prime numbers as unknows.................................................................11
Density and distribution of prime numbers..........................................11
Ulam’s Spiral and Spiral Squares.........................................................12
BIBLIOGRAPHY:...........................................................................................14
1
INTRODUCTION
Prime numbers
From elements in mathematics, prime number occupy a unique and
essential position. They are the fundamental building blocks for all natural
numbers. Prime number is defined as a natural number that is greater
than 1 and has no positive integer divisors other than 1 and itself. This
implies that prime number cannot be evenly divided (without a remainder)
by any other whole number greater than 1. The theorem of arithmetic
states that every natural number greater than 1 can be expressed
Figure uniquely as a product of primes.
1
For example, 36 can be factorized as 2 ×2 ×3 ×3 , where
every factor is a prime number.
In the Figure 1 prime numbers were marked with
orange colour. However, the number 1 is flagged
with another colour as it does not classify as
composite or prime number. As the fundamental
theorem of arithmetic states, every number has
exactly one way to be factorized by primes. If 1
were a prime, this uniqueness would be lost.
Along with larger positive integers, prime numbers
get more scare. However, it is impossible to find all
2
of them. According to Euclid’s Theorem, there are
infinitely many primes.
As prime numbers were identified to be infinite, there must be a way to
somehow identify them. The Sieve of Eratosthenes is one of the simplest
methods used to determine all the prime numbers up to a certain natural
number n . This works through the elimination of composite numbers from
interval [ 2 , n ].
The first step is to write down all the integers up to n . My n=33.
The first number is 2 and stays the same. However, every multiplicity of 2
will be eliminated. Another number that is not eliminated is 3, it stays the
same and again, every multiplicity of 3 is eliminated. Next number is 5,
which is treated the same way. This method would be continued till we
reach number a ≤ √ n. In this case,
√ n= √33 ≈ 5 , 75.
Therefore, every number that is left within our interval, is prime number.
I decided to visually present this technique below:
Figure 2: an example of the sieve of Eratosthenes method
1. 2. 3. 4. 5.
3
Congruence and its property
Prime numbers and congruence are connected to each other throughout
different fields of mathematics. Congruence may improve checking and
identifying if certain number is prime. It is also often used to finding
divisors of numbers, which are crucial to determinate prime divisors of
them. However, congruence has its own laws and properties and is
connected to modular arithmetic.
Equation of dividing two integers:
X
=Q remainder R , where:
Y
X − dividend Y −divisor Q−quotient R−remainder
This equation focuses on the remainder when using modular arithmetic.
In those situations, ‘remainder’ is replaced by modulo operator, written as
mod in the equation. Therefore, the same equation looks this way:
X mod Y =R
I will provide an example for better representation:
17
=5 remainder 2 , it is the same as: 17 mod 3=2
3
Congruence is a fundamental concept in number theory. It deals with the
remainders left after dividing two integers and describe the relationship
between them. By the definition, when the difference (a−b) is divisible by
m , integers a and b are congruent modulo m . In other words, a and b are
4
congruent modulo m , when both integers give the same remainder after
dividing them by m .
This is noted as: a ≡ b(mod m)
To illustrate, I will provide example:
( 18−6 )
18 ≡6 mod 2 ⟹ =6 (there is no remainder ), and 18 mod 2=6 mod 2=0
2
Also, congruence has its properties. They are true when a , b , c , m∈ Z +
1. Every number is congruent to itself modulo any number: a ≡ a ¿
2. If a is congruent to b modulo m , then b is congruent to a modulo m
a ≡ b ( mod m ) , then b ≡ a(mod m)
3. If a is congruent to b modulo m , and b is congruent to c modulo m ,
then a is congruent to c modulom :
a ≡ b ( mod m ) ,∧b ≡ c ( mod m ) , then a ≡ c (mod m)
4. The sum of congruent numbers modulo m is congruent to the sum
of their corresponding values modulo m :
a ≡ b ( mod m ) and c ≡d ( mod m ), then a+ c ≡ b+d ( mod m )
5. The product of congruent numbers modulo m is congruent to the
product of their corresponding values modulo m :
a ≡ b ( mod m ) and c ≡d ( mod m ), then a × c ≡ b ×d ( mod m )
5
Those properties of congruence act like properties of numbers in
arithmetic. Thanks to knowing them, we can manipulate congruences and
make deduction about remainders without explicitly calculating them.
DISCUSSION
Fermat’s Little Theorem
Despite searching for prime factors in a number that we want to check if it
is prime or composite, we may also use different theorems which are
primality tests. An example of it is Fermat’s Little Theorem. It states that: If
p is a prime number, and a number a it is not divisible by p, then
p−1
a ≡1(mod p).
However, this method is inefficient while tested numbers are big. Also, this
method is unreliable with some conditions. There may be different bases (
a , b ,c ,...) of the same exponent p−1 , for which this theorem gives different
results. Therefore, we cannot always be sure if tested number p is
composite or prime.
Wilson’s Theorem
With the usage of congruence there are also some other ways to check if a
number is prime. One of those methods is to use Wilson’s Theorem, which
states:
A positive integer n ≥ 2 is a prime number if,
6
( n−1 ) ! ≡−1 (mod n) or ( n−1 ) ! ≡(n−1)(mod n).
This theorem establishes a relationship between prime numbers and
factorials using modular arithmetic.
Euler’s Totient Function and Euler’s Totient Theorem
Like Fermat’s little theorem, Euler’s theorem is as primality test. Crucial for
this theorem, is to know Euler’s Function ϕ (n) , which counts the number of
positive integers less than n that are relatively prime to n . Relatively
primes mean that both numbers have no common factors except 1. From
the graph below, we can see that Euler’s Totient Function value if n is a
prime, ϕ ( n )=n−1.
Figure 3
7
When primality testing numbern , we use theorem: a ϕ (n ) ≡1 (mod n). If this
formula is true, n is a prime number. This method works only, when n is
positive integer and a is an integer relatively prime to n. However, this
may also be unreliable in some circumstances as some composite
numbers might satisfy this equation with a certain integer a .
Fermat’s 4n+1 Theorem and Fermat’s Numbers
Odd prime numbers can be divided by 4 , giving remainder of 1 or 3.
Therefore, we can divide those numbers into two groups: first with
remaining 1 and second with remaining 3. Those prime numbers we can
write in two forms depending on the remainder. Those are: 4 k +1 and 4 k +3,
where k in this equation is an integer.
All the odd prime numbers which can be written in the form 4 k +1, can also
be presented as the sum of two squares (Fermat’s 4n+1 Theorem):
p=a +b , where p is a prime, and a , b are integers. However, this theorem
2 2
cannot be applied to those odd primes which give remainder of 3 when
dividing by 4 [3 (mod 4)].
Figure 4
8
This Fermat’s Theorem is a classic theorem when talking about prime
n
numbers. Fermat also came up with hypothesis that 22 +1is always a prime
number, where n is positive integer. Those are now called Fermat’s
Numbers (F n - nth Fermat’s Number).
However, he only checked this for n ∈{0 , 1, 2 , 3 , 4 }. Euler was first to check
Fermat’s hypothesis, he found out that this formula does not give a prime
number when n=5. Because the number gets big very quickly, we know
Fermat’s Numbers only for n ∈{0 , 1, 2 , 3 , 4 , 5 }. Therefore, those numbers
(which are prime) are considered as infinite (as we know there is infinitely
many prime numbers).
Figure 5
9
Dirichlet’s Theorem
This theorem generalizes many known facts such as Fermat’s 4n+1
Theorem. Dirichlet stated that: there is infinitely many prime numbers in a
form nd +a , where d and a are relatively prime and positive integers, and
n> 0. For example, 4 n+1(d =4 , a=1)or 4 n+3(d=4 , a=3). In other words, there
are infinitely many primes p ≡a (mod d ¿.
Figure 6
Chebyshev’s Theorem
This theorem states that for any n that is greater than 1, there is a prime
number p , that n< p< 2n . This, however, may be simplified to:
For any number n greater than 6 there are at least two prime number
between nand 2 n. At least one of them in form 4 n+1, as well as in form
4 n+3.
10
Mersenne Numbers
Every number in a form M n=2n −1, where nis a natural number, we consider
as Mersenne’s. Every value of M n is also a sum of finite geometric series:
n 0 1 k−1
M n=2 −1=2 +2 +…+2
There is also a theorem that states that if M n is a prime number, then n is
also a prime. Similarly to Fermat’s Number, we can assume that there is
infinitely many Mersenne Number as we do not know every prime number.
Prime numbers as unknows
When searching for prime number within equations with unknows, we may
consider:
2 2 2 2
p −2 q =−1, which we can also annotate as: a n−2 bn=−1.
However, we may find unknown primes (a n andb n) only if n will be an odd
prime itself.
In Figure 7, there are all the solutions for n ≤ 30, which are odd primes and
give result of two primes (a n andb n). We may notice that those number get
bigger with every another n . Therefore, we might assume that this
equation has infinitely many solutions in prime numbers a n andb n.
Figure 7
11
Density and distribution of prime numbers
The distribution of prime numbers can be explained by Prime Number
Theorem. It states that along with the rise of prime numbers, they become
also less common. Thanks to this theorem, we may find the probability
1
that the selected integer x is prime using .
ln x
To find the density of primes we must use prime-counting function π (x )
that gives the number of primes less than or equal to x . Good
x
approximation of this prime-counting function is . Therefore, we may
ln x
x
use asymptotic notation: π ( x) , as x increases. Because there are
ln (x )
infinitely many primes, we also may notice that: lim π ( x )=∞ .
x→ ∞
Ulam’s Spiral and Spiral Squares
Ulam’s Spiral is a visual representation of prime numbers. This effect is
caused by some properties:
On diagonals there are only odd numbers or only even number. Therefore,
only on diagonals with odd numbers, primes can be generated. Also, prime
12
numbers cluster more on some of them. The centre of Ulam’s Spiral is 1
and, on the chart, above marked with orange.
Figure 8
The lines in the spiral correspond to specific quadratic polynomials, as
some of them may generate more prime numbers than others. Some
2
polynomials, which are known as Euler’s prime generating, f p ( x )=x + x + p
generate prime numbers for x=0 , 1 , … , p−2, but only when p ∈[3 , 5 , 11,17 , 41].
A polynomial: x 2−x +41, is known to generate the largest number of primes
from all the Euler’s prime-generating polynomials.
As parabolas of polynomial are placed on the spiral, they start to create
lines. This one example (Euler’s polynomial) gives a prime number for
every x ∈[0 , 39].
13
Below I represent the Spiral Square, where p=41, that is also a centre of
the spiral (highlighted with orange colour). All the primes are indicated
with pink colour. It is clearly visible that primes are located on one
diagonal. They cover every prime number generated by polynomial
x −x +41 for every x ∈[0 , 39].
2
Figure 9
BIBLIOGRAPHY:
Budzyński, M. (n.d.). Liczby pierwsze. [Link]
[Link]
Czy liczb pierwszych jest nieskończenie wiele? (n.d.).
[Link]
14
Figure 1. Gaussian primes with norms less than 1000. (n.d.).
ResearchGate. [Link]
primes-with-norms-less-than-1000_fig1_345970807
Infinitely Many Primes | Brilliant Math & Science Wiki. (n.d.).
[Link]
Jak dużo jest liczb pierwszych? | Informatyka MIMUW. (n.d.).
[Link]
Jak rozpoznajemy liczby pierwsze? - Delta. (n.d.).
[Link]
Kasprowicz, M. (n.d.). Sito Eratostenesa.
[Link]
Khan Academy. (n.d.).
[Link]
raphy/modarithmetic/a/congruence-modulo
Liczby Fermata - matematyka jest prosta. (n.d.).
[Link]
Liczby Fermata | Wrocławski Portal Matematyczny - Matematyka jest
ciekawa. (n.d.).
[Link]
fermata
Liczby Fermata. (n.d.). [Link]
Liczby pierwsze Gaussa - Delta. (n.d.).
[Link]
15
Liczby pierwsze i jednoznaczność rozkładu – ogólniej - Delta. (n.d.).
[Link]
rozkladu-ogolniej/
Liczby pierwsze i kwadraty spiralne - Delta. (n.d.).
[Link]
Liczby pierwsze jako niewiadome - Delta. (n.d.).
[Link]
Prime Numbers | Brilliant Math & Science Wiki. (n.d.).
[Link]
Rzepka, R. (n.d.). Liczby pierwsze. Copyright Owner.
[Link]
Schildt, M. (n.d.). Congruence. Pressbooks.
[Link]
SzaloneLiczby. (2017, March 9). Liczby pierwsze i złożone - Matematyka.
Szalone Liczby. [Link]
Testbook. (2023, June 29). Euler’s Theorem: Learn Statement, Proof,
Applications & Examples. Testbook.
[Link]
Twierdzenie Eulera | Informatyka MIMUW. (n.d.).
[Link]
Twierdzenie Fermata o rozkładzie liczby pierwszej na sumę kwadratów -
Delta. (n.d.). [Link]
rozkladzie-liczby-pierwszej-na-sume-kwadratow/
16
Twierdzenie o dwóch kwadratach. (n.d.).
[Link]
kwadratow
User, S. (n.d.). [Link] - Baza wiedzy.
[Link]
W poszukiwaniu liczb pierwszych | Poznański Portal Matematyczny. (n.d.).
[Link]
pierwszych/
What is modular arithmetic? (article) | Khan Academy. (n.d.).
[Link]
raphy/modarithmetic/a/what-is-modular-arithmetic
Wikipedia contributors. (2024, March 11). Euler’s totient function.
Wikipedia. [Link]
Wikiwand - Twierdzenie Fermata o sumie dwóch kwadratów. (n.d.).
Wikiwand.
[Link]
%C3%B3ch_kwadrat%C3%B3w
Wolfram Research, Inc. (n.d.-a). Gaussian Prime -- from Wolfram
MathWorld. [Link]
17