0% found this document useful (0 votes)
49 views24 pages

Primality Testing Methods Explained

Uploaded by

GURNOOR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views24 pages

Primality Testing Methods Explained

Uploaded by

GURNOOR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MELBOURNE UNI MATHEMATICS & STATISTICS COMPETITION

A XU, E JIA, J HADDAD


NEWINGTON COLLEGE

QUESTION 8
MR CHE SHIRE’S
PRIMES
PROBLEM
Mr Che Shire likes numbers, but not just any regular numbers, they are particularly fond of
prime numbers. Mr Che Shire knows that there are infinitely many prime numbers, and they
really want to know how one can determine whether an arbitrary number is prime. They
overheard someone at the last ClubPrime meeting mention that such an undertaking is
known as a primality test and they are keen to know more. As an active and enthusiastic
member of ClubPrime, you have taken it upon yourself to prepare a detailed report (via any
format of your choosing) to share with Mr Che Shire on the wonders of primality testing. At
first, you are considering the following:

- What even is a prime number and why are they special?


- What are existing methods for testing whether a number is prime and how do they
work?
- Can one be certain that a number is prime? Why/why not?

You present your findings to Mr Che Shire who is so impressed that they would love for you
to build a primality test which members of ClubPrime will use to promote prime numbers to
the community. Mr Che Shire is quite laid back, so they are happy to accept that your
primality test may not be spot on every time.

- To what extent of reliability will you devise your primality test?


- What features of your primality test make it stand out amongst commercially
available ones?
- What else can you include in your reporting and/or primality test to impress Mr Che
Shire?
2

Some primes garner more attention than others (e.g. neighbouring primes, super
primes, Euler primes, Mersenne primes, etc). ClubPrime is pleased to name a new
category of primes after you for your contribution to the community.

- What property/attribute will distinguish your primes from other primes?

- What will you name this new category of prime numbers?


3

Contents:
1 Introduction 4

1.1 Paper definitions 4

1.2 Euclid’s proof of infinite primes 4

2 Primality tests 5

2.1 Existing Primality tests 5

2.1.1 Trial Division Method 5

2.1.2 Fermat’s Primality Test 5

2.1.2.1 Flaws 6

2.1.3 Miller-Rabin Primality test 7

2.1.4 Solovay-Strassen Primality test 8

2.2 Our own Primality Test 8

2.2.1 How does it work? 8

2.2.1.1 Fermat’s Little Theorem 8

2.2.1.2 Square Factorisation 9

2.2.1.3 Application to Prime Generation 10

2.2.2 Testing of Results 11

2.2.2.1 Efficiency of program 12

2.2.2.2 Accuracy of program 13

2.2.2.3 Reliability of program 14

2.2.3 Time Complexity 14

2.2.4 Deconstruction of Code 15

2.3 Deterministic Primality Testing 17

3 Our new category of Primes 18

3.1 Sierpinski and Riesel Numbers 18

3.2 Our New Brier Primes 19

4 Appendix 20
4

1 Introduction
1.1 Paper Definitions
Before the proof begins, we have set a few definitions for this paper:

- We say a number a divides b if b = aK such that 𝐾 ∈ 𝑍 where Z is the set of natural


numbers
- We define a prime number as a natural number such that its number of factors
equates to 2. Note that by our definition 1 is not a prime number.
- We also define a primality test as a function that takes in a positive integer and
outputs a boolean that tells us whether this number is prime or composite.

1.2 An infinite number of prime numbers (Euclid's proof)

The only reason we should test for primes is because we know that there are infinite of them,
and we can prove it as such through contrapositive. For the sake of contradiction, let us
assume that there IS a finite number of prime numbers. We will denote the sequence of all
prime numbers with

𝑝1 , 𝑝2 , 𝑝3, .... , 𝑝𝑖

Consider the number n where n equals one more than the product of all primes. Note that
𝑛 − 1 is the product of all primes (where there are a finite number of prime numbers).

𝑛 = 𝑝1 𝑝2 𝑝3 .... 𝑝𝑛 + 1

Since n itself is 1 more than the product of all primes, it cannot be divisible by any of the
primes in our sequence. Therefore there are two possible conclusions we can draw from this.

1. n is prime

However this assumption fundamentally contradicts our first assumption as n was


previously not in the sequence of all possible primes. This concludes that our
beginning assumption is false and so demonstrates that there are an infinite number
of primes

2. Lemma 1. n is composite
5

Proof. For any composite number, its prime decomposition must have (a) number(s)
other than 1 and itself. Every number can be factored into a certain prime
decomposition, this is known as the fundamental theorem of arithmetic. However, as
previously stated, it cannot divide any of the primes since it is one larger than the
product of all of them. This contradicts the assumption that n is composite, and
hence n cannot be composite and must be prime, and therefore n is a larger prime
which contradicts the initial assumption that there are finite primes, and thus by
contradiction there must be infinite primes.

2 Primality tests
2.1 Existing primality tests

2.1.1 Trial division method


See Appendix Figure.1

Using our fundamental knowledge of primes, we can make a very rudimentary primality test.
This is a deterministic primality test that searches every integer less than the ceiling of a
square root of a number and checks whether it divides the number you are testing for. This
method’s basis is the definition of a prime number itself. The only problem it has is that it
requires immense computing power, for a 15 digit number (10*14) your computer would need
7
to run a loop 1 × 10 times. Therefore, this test is basically useless when it comes to large
numbers, so better methods exist. We explore 3 popular ones: The Fermat Test, the
Miller-Rabin test and the Solovay-Strassen Test.

2.1.2 Fermat primality test


The Fermat primality test is one of the most simple primality tests.
Let us denote the number you want to test for primality p. Fermat’s primality test
hinges on the following equation, known as Fermat’s little theorem, where p is prime
and a is an integer.
𝑝
𝑎 − 𝑎 = 𝑠𝑜𝑚𝑒 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 𝑝, 𝑤ℎ𝑒𝑟𝑒 {1 ≤ 𝑎 < 𝑝}
Furthermore, if a and p are coprime, then the following is also true.
6

𝑝−1
𝑎 ≡ 1(𝑚𝑜𝑑 𝑝)
This is the key formula to the Fermat primality test. The main flaw is that the
converse of the equation is not generally true. (This will be elaborated upon later)

The Fermat primality test is implemented in the following way:


The program takes a user input integer, let it be n.
It will repeat the following k times to increase the likelihood of a correct answer. The
program takes a random integer a in the range [2, 𝑛 − 2]. The reason that we don’t
take a from values 1 or n-1 is that if
𝑎 ≡ 1 𝑜𝑟 − 1 (𝑚𝑜𝑑 𝑛)
𝑛−1 𝑛−1
𝑎 ≡ 1 (𝑚𝑜𝑑 𝑛) will hold trivially for an odd value of p. Therefore if 𝑎 is not
congruent to 1 (𝑚𝑜𝑑 𝑛) then the input n will be false.
The method can be easily coded in python, see below:

See appendix Figure 1.1

2.1.2.1 Flaws within this method (and other methods)


There are significant flaws with this method. First of all, as previously stated, the
converse of the equation itself is inherently not generally true. This means that while
𝑝−1
the expression of 𝑎 ≡ 1(𝑚𝑜𝑑 𝑝) will be true if we take values a and p, such that p is
prime and a and p are coprime, just because some numbers have satisfied the
equation doesn’t mean that they are necessarily values that satisfy what we have
stated about a and p. This results in the existence of ‘Fermat Pseudoprimes to the
base a”, where these Pseudoprimes are numbers where there is another number a that
together satisfies Fermat’s equation such, except ultimately the Pseudoprime isn’t
prime at all.

17−1
For example, if we take the prime number 17, and integer a= 6, 6 ≡ 1 (𝑚𝑜𝑑 17)
will definitely be true.

(221−1)
HOWEVER, if we have the correct equation 38 ≡ 1 (𝑚𝑜𝑑 221), it DOES NOT
necessitate 221 being prime. In this case, we call the number 38 a ‘Fermat Liar’, and
221 is a “Fermat Pseudoprime to the base 38”. In our equation, we try to avoid these
cases with Fermat liars by simply repeatedly running the program. For example,
consider the program is running again such that this time 24 has been chosen.
7

(221−1)
24 is not congruent to 1 modulo 221. This shows that 221 is a composite. This
time, the number 24 is what we call a ‘Fermat witness’.

Furthermore, there is a special category of numbers known as “Carmichael


Numbers”. Carmichael numbers are a special category of Pseudoprimes, where every
possible value of a where gcd(a, n) = 1 is a Fermat Liar. There are no Fermat
Witnesses a other than it’s factors to catch out the plucky composite. An example of a
Carmichael Number is the number 561. The fermat primality test would never be able
to tell that 561 is composite, unless it stumbles across one of the factors/non-coprime
number, eg 57. Therefore in the case of carmichael numbers, the code is essentially
just a basic factor finder.
However there exist other significantly more accurate probabilistic tests such as
Miller-Rabin or Solovay-Strassen. However, note that similar flaws will still exist in
these more complex methods, it is simply that they are less prevalent.

2.1.3 Miller-Rabin Primality Test


The Miller-Rabin primality test is the most widely used Primality Test due to its
efficiency along with its high probabilistic yield.
The method used is simply by taking in two values, one being the number being
tested and the other being the number of loops of code.
𝑠
Given any odd prime value (n), we can write it as 2 × 𝑑 + 1, where s and d are
integers and d is odd. We take an integer a that is randomly found between values 2
and n-2.
We essentially test for whether either of the following hold true, and if they don’t the
number must be composite:

, where r is some value between 0 and s


The reason for the first equation is that:
𝑠
𝑑 2
If it holds, then (𝑎 ) ≡ 1 (𝑚𝑜𝑑 𝑛)

This means that Fermat’s Little Theorem holds, ​ . This means


that the number n is a probably prime
The reason for the second equation is that:
2
Note that a number p is prime if and only if the solutions to 𝑎 ≡ 1 𝑚𝑜𝑑 𝑝 are ± 1.
8

Furthermore, every number in the sequence is the square


root of the previous.
𝑠
2 𝑑 2
Therefore, if the number n is prime, 𝑎 𝑚𝑜𝑑 𝑛 = 1... (𝑎 ) 𝑚𝑜𝑑 𝑛 =± 1
However, some numbers can still fool this and thus we iterate it to ensure that every

value in the sequence mod n is either 1 or -1. If we find


something that isn't 1 or -1, we know that n is composite.
If we find that any value that is -1, then it is sufficient to stop the loop and return
probably prime.

For code, See appendix figure 1.2

2.1.4 Solovay-Strassen Primality test


This test is incredibly similar to Miller-Rabin, however it is based in different
equations. The Solovay-Strassen Primality test is founded in Euler's proof that given

some a and odd prime p, . In this case (a/p) is the


Legendre symbol. Thus, when we are given some odd number n, we can test it in p’s
place to see if the equation holds. If it doesn't hold, we immediately know that n is
composite, while if it does hold it means it's possibly prime, but not necessarily
prime, since the converse of this Euler theorem is not necessarily true. We can use the
generalisation of Legendre by Jacobi to find (a/n). Overall, it follows the same general
idea as Fermat's/Miller-Rabin’s primality test. Like these, there are bases that are liars
and witnesses, in this case called Euler liars and Euler witnesses. Thus, it is
probabilistic and its success rate can be increased by increasing the repetitions of k.

For Code, See appendix figure 1.3

2.2 Our Own Primality Test: “The Bitwise Test”

2.2.1 How does it work?

2.2.1.1 Fermat’s Little Theorem


For a probabilistic primality test, the compiler will not always return the boolean
(true/false) with 100% certainty, though the accuracy in the Bitwise Primality test is
9

still well within acceptable limits. (Roughly around 3 in a million chance with just
k=9, and we are testing with k=40, basically very accurate).

Let us denote the input number as n for now. In order to distinguish whether n is
prime or composite, we will first assume that n is prime, and if we arrive at a false
statement, which means we have disproved our beginning assumption, and so our
program will return false because n is now proved composite. Considering Fermat’s
Little Theorem, we can denote that n will be prime if
𝑛−1
𝑎 ≡ 1(𝑚𝑜𝑑 𝑛)
Where a again will be {1 ≤ 𝑎 < 𝑛 − 1}. Using simple modular arithmetic, we can
easily alter the equation to arrive at this revised variation of Fermat’s Little Theorem,
which is
𝑛−1
𝑎 − 1 ≡ 0 (𝑚𝑜𝑑 𝑛)
Keep in mind here that we are still assuming p is prime because we haven’t been
proved otherwise.

2.2.1.2 Square Factorisation


Since all primes are odd (except for 2 which we treat as a corner case), n-1 is even and
so we can further simplify this using difference of squares factorisation which arrives
at
𝑛−1 𝑛−1
2 2
(𝑎 − 1)(𝑎 + 1) ≡ 0 (𝑚𝑜𝑑 𝑛)
From at this step we have 2 possibilities:
1. 𝑛 − 1 ≡ 1 (𝑚𝑜𝑑 2). From here we can terminate the process and return a
boolean of false because we have proved our original assumption that n is
prime false. This is because n must be odd to be a prime number and if the
result is even then n must be even.

2. Lemma 2. 𝑛 − 1 𝑛𝑜𝑡 ≡ 1(𝑚𝑜𝑑 2). This means we possibly can further


𝑛−1

factorise (𝑎 2
− 1) through difference of squares, resulting in
𝑛−1 𝑛−1 𝑛−1
4 4 2
(𝑎 − 1)(𝑎 + 1)(𝑎 + 1) ≡ 0 (𝑚𝑜𝑑 𝑛)

This step is repeated until the exponent returns odd and cannot expand further,
resulting in
10

𝑛−1 𝑛−1 𝑛−1


𝑘 𝑘
2 2 2
(𝑎 − 1)(𝑎 + 1) .... (𝑎 + 1) ≡ 0 (𝑚𝑜𝑑 𝑛)
This means that the exponent must be odd, because if it was even, we would simplify
𝑛−1
it further, so 𝑘 is odd. If n is prime, which was our beginning assumption, then that
2
𝑛−1

means n must divide one of these terms e.g (𝑎 − 1). This fact is also known as
𝑘
2

Euclid’s Lemma. However, if n doesn’t divide any of these terms, it must be


composite. Therefore we can determine whether the number n given is a prime or
composite number.

Note: Euclid’s Lemma states that if there are integers 𝑎1, 𝑎2,... 𝑎𝑘 such that prime p
divides 𝑎1 𝑎2 ... 𝑎𝑘, then p divides at least one of these values a.

2.2.1.3 Application to Generation of Primes


Our method can be used for the application of prime generation.

One existing method of prime generation is to use Mills Theorem.


Mills theorem states that
𝑛
3
⌊λ ⌋ = a prime number
Where λ is known as the mill's constant and approximates to 1.3063778838630…
Consider the number n to be 3,
3
3
⌊1. 3063778838630 ⌋ = ⌊1361. 00000108⌋ = 1361
Therefore 1361 is a prime number. Note that we are taking the floor of the returned
value and so will round down the float to the next lowest integer.

See appendix Figure 2

There are quite hefty limitations of this method however. Really it can only generate
8 set prime numbers (any value of n above 8 will cause python to return an error
because the integer is too large) because of the way the equation is set up if the input
n doesn’t change the output prime will remain constant.
Therefore, this method is not effective, and thus we use our primality test as a
method.
11

Using bitwise shifts, we can efficiently create a large range for a computer to take
numbers from to test for primality.

We use the die.randrange() to generate a random number within some range of bits
(which a user can input), Let us denote the number a as a random odd integer with
bits number of bits. We can use the python bitwise left shift operator (<<) to shift the
number 1 (which is now in binary) leftwards by bits number of bits, and then shifting
𝑎−1
it rightwards by 1 bit. This essentially gives the number 2 , which we use as the
lower bound of the random selector. The upper bound of the random selecter is
𝑎
equivalent to 1 bit shifted left bits number of bits, essentially giving the number 2 . A
random number is chosen in this range, and then it is bit shifted once to the left,
essentially doubling its value and thus ensuring it is even.

Example. User has input 5…


The lower bound of the random selection will be 16, and the upper bound 32. The
computer will select a random number in this range, double it and add 1, and test
for primality. Success will result in the prime being printed and failure will
continue the loop.

Furthermore, by adding 1 to the binary after it has been bit shifted, it ensures
that the final digit of the binary is 1, which means that the base 10 number can
be guaranteed to be odd. [to ensure no cpu is wasted on testing even numbers]

See Appendix Figure 2.1

Further explanation will be given in the code explanation section.

Our method is ultimately named after this feature.

2.2.2 Testing of Results


Consider the number 6. 6 isn’t prime but it divides into 12. 12 however can also be
written as 3 × 4 but 6 doesn’t divide into either one of these terms because 3 and 4
are factors of 12, thus making 6 composite (and also 12). And so in our testing
implementation, we check this one by one and if at least one of these terms is
divisible by n then we have satisfied our original assumption and n is prime. This test
12

however only gives us a 75% chance that our number n is prime. There is still a 25%
1
(or 4
) chance that the number n is composite, through numbers such as
pseudo-primes. This is because we have only tested the input number n in one base,
which was a. This base is also known as a witness, and there is no simple way to find a
witness for a specific number that it isn't a strong pseudoprime to. A naive solution to
this is to test a large number of bases, which results in a relatively less efficient test.

By testing this number once again this time with an altered value of a, the chance of
1
n being composite after passing all tests drops to 6.25% (or 16
) chance.

And we can see where this is going. The bitwise primality test hinges on a certain
number of cycles, or a in this case, for accuracy. This is also held true for both a well
performed Fermat Test, Solovay-Strassen and a Miller Rabin test. The recommended
number of cycles is 40, and will not prove taxing on the computer.

Thankfully no composite number is a strong pseudoprime in all bases so what we


have done in our algorithm is randomly select a number of bases, defaulting to 40
(which is recommended).

2.2.2.1 Efficiency of algorithm

Note: Integral number inputs are taken from question

Integral Number Input Time taken (seconds) Output (Boolean)

12345678 No delay False

131071 No delay True

12345678910987654321 No delay True

1111111111111111111 No delay True

998001 No delay False

600851475143 No delay False

82589933 No delay True

3133353739 No delay False

999999000001 No delay True


13

1279 No delay True

1022003330004444000055 No delay True


5550000055555000044440
00333002201

1217992693321185900311 ~0.001 True


6447179804577770153804
9113557935591274529163
6988499680018869389313
0928096792480256138000
3359314462403413729081
5718284997108122276868
2379196683000078083431
5666159815949049736207
6763105291387819323510
2883208044533397331000
9937810478228129173015
9339980115972728746159
54064713623723

2.2.2.2 Accuracy of Algorithm


Note: Integral number inputs are taken from question
Extra Note: Our algorithm calculates > double the number of digits the commercial
one can.
Online Primality Test (https://randommer.io/check-prime-number)
Note that this website uses the CPU method

Integral Number Witness count (a) Perceived Output Output of


Input commercially
available
calculator

25326001 (which is 10 (30 less than False False


a strong recommended)
pseudoprime in
bases 2 and 3)

25326001 1 2
False ( 25326000 False
chance to return
True, which is an
incorrect output)

112592 (Strong 10 False False


Lucas
pseudoprime)
14

112592 1 False False

2.2.2.3 Reliability of Results


The customisability of our algorithm is what separates it from commercially available
primality tests. The user can determine the accuracy or efficiency of the algorithm
through different values of a, or the number of witnesses along with the much higher
efficiency rate, calculating larger numbers in a shorter time.

The error made by the primality test is measured by the probability that a composite
number is accidentally declared prime. It can be shown that if n is composite, then at
1
most only 4
of the bases create strong pseudoprimes for n. Therefore if n is
composite and you are running a number of iterations of the test the probability that
−𝑎
the test declares n prime inaccurately is 4 .

For most numbers n, the probability of this occurring is actually bounded by a value
−𝑎
much smaller than 4 . This is because for large values of n (> 64 bit integers ), the
probability of a composite number being declared prime is much smaller. Therefore
−𝑎
the average case has a much better probability of it testing correctly (roughly 8 ).

Mathematically, this can be denoted as conditional probability, denoted as


𝑃𝑟(𝑇𝑘| ¬𝑃)
𝑇𝑘 denotes the event that n passes the Bitwise test in k rounds.

2.2.3 Time complexity of our code


The time complexity of given code is the estimation of that program’s efficiency
regardless of the certain machine it runs on. The time complexity can be retrieved
from counting the number of operations performed by your code. Usually this time
complexity is defined as a function of the input size (n) using Big-O notation, where n
is the input size or array to be tested and O the worst case scenario for growth. There
are multiple ways to classify Big-O notation depending on the efficiency of your
algorithm, for example a piece of code that returns any output with the same delay
independent of the size of the input will be scaled as O(1); there’s no delay. However,
take for example, you are performing a function on every item on an array, therefore
the code complexity could be scaled at O(n), you are performing a function for every
15

value in the array and so the time would scale linearly with the array size. If n (which
is denoting the length of the array) doubles, the output time would double as well. To
calculate the Big O notation for our program we denote the input number to be n and
the number of cycles to be k. Since we are testing for primality k number of times we
already know that

O(k * time complexity for primality test)

Therefore we only need to look at the single_test function from our bitwise
primality test. In the single_test function, we have 2 while loops that are
independent of each other, and each while loop essentially loops through
almost all of n twice, therefore making it 2n. If statements are rendered
redundant because they execute 100% of the time. Also keep in mind that this
is stored in a logarithmic function because the larger the prime number
becomes the less extra computing power is required due to large primes being
extremely rare. Our time complexity would therefore be:

𝑂(𝑘 · 𝑙𝑜𝑔(2𝑛))

2.2.4 Deconstruction of the code

We first get access to two libraries: the random and date-time library. The random
library will be used to generate random numbers of a to test for n. The DateTime
library will only be used to see how long it takes for our process to undertake.
16

The single-test function takes in two values, n being the input number we are testing
for primality and a the base we are testing on for primality. Exp is set to n - 1, which
is, through Lemma 2, is the exponent we are testing whether it's odd or even.

The function primality_test takes in an input number n and k number of cycles. We


assign a with a random base between 2 and the exponent (n-1) and then perform a
single_test (see code snippet above) and if it doesn’t pass then the code returns false.
This process is repeated k times to ensure accuracy.

There's not much to explain here except for line 6. The code first takes a random
integer between 1 << bits - 1 and 1 << bits. 1 in binary is 00000001, and you bitwise
left shift it by bits number of bits. Let us denote bits as 2 (the user has inputted 2 as
the # ) for the sake of this explanation.
000000001(𝑏𝑎𝑠𝑒 2) << 2 − 1 = 000000010(𝑏𝑎𝑠𝑒 2) = 2
000000001(𝑏𝑎𝑠𝑒 2) << 2 = 000000100(𝑏𝑎𝑠𝑒 2) = 4
17

So the die takes a random integer between 2 and 4. This number is then left shifted
again. Let us consider the following if the die returned with 4.
00000100(𝑏𝑎𝑠𝑒 2) << 1 = 8(𝑏𝑎𝑠𝑒 10)
This always returns an even number due to the nature of the bitwise left shift
function, and to eliminate any useless testing (all evens are composites with the
exception of 2) we will add 1 to ensure the number is odd.

Therefore the code will primality test the number 9 which returns false and the cycle
continues
If it returns true, the cycle ends and the number is printed.

This is all just inputs, first asking for an input number to test and then asking
whether the user wants to generate a prime number with a certain number of bits of
the prime. At the very end, we print the time it took for the process to undergo.

2.3 Deterministic primality testing


Currently the vast majority of primality tests are probabilistic, meaning
that there isn’t a 100% chance that the output returns with the
mathematically correct number (although the chance is usually very very
small)

Can we always be sure a number is prime? Well, in order to do so we must have


something known as a deterministic primality test, which can give an accurate
boolean of true/fase 100% of the time.

Most deterministic primality tests suffer from at least 1 of three flaws:


- Not being able to be applied to all numbers, these may only be used to find certain
classes of primes.
18

- Not being able to be run in big-O polynomial time. For example, one can you
Wilson’s theorem to find primes, but it is highly inefficient.
- It is dependent on theorems that are yet to be proven. For example, Millers
primality test (deterministic version of miller-rabin) suffers from relying on the
unproven Extended Riemann Hypothesis.

However, there is one deterministic primality test that has been created so far,
known as the AKS primality test. This test is vastly more complex than Miller-Rabin
or Solovay-Strassen, and runs considerably slower.

3 Our new category of primes: Brier


Primes
Sierpinski and Riesel Numbers
Sierpinski and Riesel numbers are a mysterious group of numbers, and of great
mathematical intrigue.

Sierpinski numbers are odd positive integers K, such that for all positive integers n,
is composite.
On the other hand, Riesel numbers are odd positive integers K such that for all
positive integers n, is composite.
The hunt for Riesel and Sierpinski numbers is a significant challenge, especially
since that there are very few, and it is very hard to determine what numbers are
Riesel and Sierpinski.
The hunt to find the lowest Riesel and Sierpinski Numbers is called the Riesel
Problem and the Sierpinski Problem respectively.
However, it has been proven that there are infinite both Riesel and Sierpinski
Numbers.
The current method to find Riesel and Sierpinski numbers is essentially to eliminate
numbers k that are not Riesel and Sierpinski numbers by testing values of n, yielding
massive numbers which are tested for primality. This ties in with the development of
primality testers, discussed in the previous section of this project. Some immense
primes have been yielded, including those with over 9 million digits.

The internet hunt projects that eliminates candidates of k in these number


categories are called the ‘Riesel Sieve’ and ‘Seventeen or Bust’ respectively.
19

Numbers k can be conclusively proven to be Riesel or Sierpinski numbers by the


discovery of a cover set, a set of small primes that ‘covers’ every possible resulting
value, proving compositeness.

Furthermore, some numbers are both Riesel Numbers and Sierpinski Numbers.
These are even more incredibly rare, and are called Brier Numbers.

Here is the list of some of the so far confirmed Riesel Numbers [confirmed cover
sets]:

509203, 762701, 777149, 790841, 992077, 1106681, 1247173, 1254341, 1330207,


1330319, 1715053, 1730653, 1730681, 1744117, 1830187, 1976473, 2136283,
2251349, 2313487, 2344211, 2554843, 2924861, 3079469, 3177553, 3292241,
3419789, 3423373, 3580901

Here is the list of some of the so far confirmed Sierpinski Numbers [confirmed cover
sets]:

78557, 271129, 271577, 322523, 327739, 482719, 575041, 603713, 903983, 934909,
965431, 1259779, 1290677, 1518781, 1624097, 1639459, 1777613, 2131043, 2131099,
2191531, 2510177, 2541601, 2576089, 2931767, 2931991, 3083723, 3098059,
3555593, 3608251.

Our New Brier Primes

Our new category of primes is called ‘Brier Primes’. These are prime numbers that
are also either Riesel Numbers or Sierpinski Numbers. They are to use the term Brier
because that is the term given to numbers that are both Riesel Numbers and
Sierpinski Numbers. Although it may be deceptive to call them Brier Primes as they
aren’t necessarily Brier Numbers, the number Brier elucidates the notion that the
category encompasses both Riesel and Sierpenski Numbers.

The strong link between Riesel/Sierpinski Numbers and the need to develop high
efficiency primality testers, along with the strong mathematical intrigue
surrounding these is why we nominate this new category of primes to be made
official by ClubPrime. Using our primality tester we have made, we can test to find
the first few Brier Primes, by inputting the first few known Sierpinski and Reisel
Numbers. (see appendix figure 3.1)
20

4 Appendix
Figure 1 - Trial Division Code

Figure 1.1 - Fermat’s Primality Test


21

Figure 1.2 - Miller Rabin Primality Test


22

Figure 1.3 - Solovay Strassen Primality Test

Figure 2 - Mill’s prime generation


23

Figure 2.1 - Bitwise prime generation

Figure 3.1 List of

Sorted by category:

Brier Prime Category

509203 Riesel Number

Riesel Number
1330207

Riesel Number
2251349

Riesel Number
2554843

Riesel Number
2924861

Riesel Number
3177553

Riesel Number
3292241

Riesel Number
3580901

271129 Sierpinski Number

322523 Sierpinski Number

327739 Sierpinski Number


24

Sierpinski Number
482719

Sierpinski Number
934909

Sierpinski Number
1639459

Sierpinski Number
2131043

Sierpinski Number
2131099

Sierpinski Number
2576089

Sierpinski Number
3098059

Sierpinski Number
3608251

You might also like