top of page
[X] logo.jpg

Lovisa Sigfridsson and Alexandra Arnmark


Year of study:


A Prime Keeper of Secrets


The reason that your emails to bank details can be kept private and safe is modern cryptography systems. These systems rely on extremely large prime numbers, numbers that can only be divided by themselves and one. Luckily, there exist plenty of so-called primality tests to determine if a number is prime or not. We decided to study one of these tests, called the Fermat primality test, which sometimes determines a number to be prime even though it is not. It was examined how often this happened and how reliable the test is.

Having written a program that ran all numbers between 1 and 5000 through the Fermat test, graphs indicating the reliability of the test for each number were generated. Surprisingly, distinct visual patterns emerged. Although we have been able to prove some of the patterns by finding similarities in structural properties of numbers, some aspects of the patterns still remain a mystery.

The results from our investigation indicate that the Fermat test works well as a primality test.

However, there are a few exceptions. The already discovered Carmichael numbers will always give false positives in the Fermat test, but our study shows that there are other numbers with a relatively high risk of giving false positives. Although these numbers do not pose a threat to today’s cryptography system, they may be interesting from a purely theoretical perspective since in the pursuit to explain the visual patterns, links to abstract algebra were found.


The year is 2021. Deep in a dark forest in the south of Sweden, an astronomy camp is having their formal dinner in a remote cabin. Most students are having a good time, but two students seem distracted. A napkin with scribbles is passed back and forth between them. These scribbles are the start of something big, a collaboration that would last until this very day. This was how our research project came to be. We are two Swedish students, Alexandra Arnmark and Lovisa Sigfridsson, who enjoy looking at patterns in prime numbers. But make no mistake; we also enjoy presenting maths in an entertaining and fun way. Lovisa is a mathematics bachelor student at Stockholm University who is currently doing an exchange year at the University of Glasgow, and Alexandra is a student at Chalmers University of Technology studying applied mathematics. Being from different cities, we can often be found in video calls, going off on tangents about everything from cute highland cows to philosophical discussions when we should be working on our research.

bottom of page