Lab centrifuges and prime numbers

When micro- or molecular biologists do research on viruses, bacteria, fungi, human or animal cells, one of the many instruments they will use is a laboratory centrifuge. This equipment allows them to separate substances contained within a test tube. This way scientists are able to obtain, for instance, purified enveloped viruses, such as the novel coronavirus, SARS-CoV-2. Or they can isolate nucleic acids, such as DNA.

Often, the rotor of the machine rotates at incredible speeds. It is vital that the test tubes have been placed in a perfectly balanced way. If not, the machine might break down and potentially dangerous glass shards and substances might be flinging about1.

Fortunately, there is a nifty way to calculate whether you can – in principle – place a certain number of test tubes in an evenly balanced way. To crack the code, we will use my favourite type of number: the prime numbers. Fun fact: this funky little trick wasn’t proven until fairly recently in 2010.

NEW: Listen to the audio |

The set-up

Before we begin, we assume that the mass of each test tube, including their contents, is equal. Also, I would like to remark that, of course, we could do this the physics way, using angular velocity and torque and all that, but in this case, we’re going to be all mathy about it, or specifically, in a way, number-theoretical.

Suppose, the machine can hold eight test tubes. Eight holes are positioned in a circle on the rotor bit of the machine.

If we have just one test tube, there’s no way we can make it balanced. That much is clear. If we have two test tubes, however, no problem. They can be balanced easily. Just put one on either side precisely opposite each other. Three test tubes? Hm. I don’t see how. Whatever arrangement we try, it’s always going to be asymmetrical. What if you have four test tubes? Well, this is easy enough. Make it symmetric, like a square.

Okay, so what about five test tubes? Well, that’s just the same as when we had the inverse of this, with three test tubes! That couldn’t be done, so, this can’t be done either.

Six? Yeah, of course, we can do that. It’s just the same as having two test tubes, it’s just the inverse! Three on one side and three on the other side. Now you have two open spots on either side. Perfectly symmetrical, just like the inverse situation, where you had two test tubes and six open spots.

Seven? No. You will have guessed it by now. Having seven test tubes is exactly the same as having just one test tube in a rotor with eight spots.

And eight, well, of course, we can do eight. It’s also the exact same as having no test tubes at all. So, yes, that’s balanced.

Do you see a pattern here? You might. Notice how the number of occupied spots and empty spots always complement each other.

Prime factorization

Just for clarity’s sake, I’m going to call whole numbers integers since that’s what they’re called in mathematics.

So, I’m assuming we all know what a prime number is: an integer greater than 1 which cannot be formed by multiplying two smaller integers. In high school or even in primary school, you may have been taught that prime numbers are numbers which can only be divided by 1 or by itself (not including 1). So, prime numbers are 2, 3, 5, 7, 11, 13, 17 and so on.

Prime factorization is writing down any non-prime integer as a multiplication of two or more prime numbers. The fundamental theorem of arithmetic states that any integer is either itself a prime number or can be written as a product of prime numbers. This is one of the reasons why they’re my favourite. Primes are the building blocks of any integer.

So, for instance, we take the number 15. This number can be written as $ 15 = 3 \times 5 $. Or take 279. We can write $ 279 = 3 \times 3 \times 31 = 3^2 \times 31 $. Let’s take 16. This number can be written down as $ 16 = 2 \times 2 \times 2 \times 2= 2^4 $.

As you can see, prime factorization is pulling apart a non-prime number into a product of prime numbers. We call the latter prime factors. 

So, that’s what that is. One of the many applications of prime factorization is finding the greatest common divisor between two integers, for example. Or encrypting (and decrypting) secret files and messages. Here, we’re going to use it for calculating whether test tubes can be arranged in a balanced way.

The trick

Suppose, your machine has $n$ spots available. Suppose, $k$ is the number of test tubes. The number of empty spots is $n-k$. Here’s the trick.

Determine the prime factors of $n$. If (and only if) $k$ can be written as a sum of these prime factors and the number of empty spots $n-k$ can be written as a sum of these prime factors, you can in principle balance the rotor.

The mathematics

It’s too technical to discuss at length the proof given by Gary Sivek in his 2010 paper (or here). However, the gist for the more mathematically inclined is available by clicking ‘expand’. You may skip this paragraph if this is (understandably) still too technical.


Striving to obtain an $n$-th cyclotomic polynomial (or prime polynomial), we obtain a series of complex numbers $z^n$ which satisfy $z^n = 1$, all being $n$-th roots of unity where $n$ is the number of total spots on the centrifuge. We then map the test tubes onto the roots of unity in a non-overlapping way. As is well-known, the values of $z \in \mathbb{C}$ are given by $e^{\frac{2\pi i}{n} k}$, where $1 \leqslant k \leqslant n$.

So, now we have $k$ roots of unity among the $n$-th roots of unity representing the occupied spots in the centrifuge.

Sivek proved, using Leung’s and Lam’s Theorem, that if (and only if) the sum of the $n$-powered $k$ roots of unity and the sum of the $n$-powered $n-k$ roots ‘vanish’, i.e. are equal to zero (using good-old de Moivre’s formula, if you remember from your very first semester at uni), as long as $n \geqslant 2$ and $1 \leqslant k l\eqslant n-1 $, then balancing is a fact (where $k=0$ and $k=n$ were regarded to be trivial cases for obvious reasons).

As you can see, no classical mechanics required.

An example with eight roots of unity in the complex plane

Obvious examples

Suppose, we take our centrifuge which was capable of handling 8 test tubes. We have 6 test tubes. First thing we do is calculate which prime factors the number 8 has. We know this, it’s all 2s. So, the only prime factor of 8 is 2. We can write the number of test tubes, 6, as a sum of this prime factor 2: $6 = 2 + 2 + 2$. The number of empty spots, that’s $8-6 = 2$, is the prime factor itself! So, yes, if you have 6 test tubes, you can balance the machine.

Let’s take 7 test tubes. Can this be written as a sum of the prime factors of 8? No, it can’t. Well, that’s it then. We cannot arrange the test tubes in such a way that it’ll be balanced out.

A counter-intuitive example

Suppose, our centrifuge is capable of handling 12 test tubes in total. We only have 7 test tubes. Hm. Surely, we can imagine 6 test tubes working, but can we make a balanced arrangement with 7 test tubes?

Let’s first do some prime factorization with 12. So, $ 12 = 2 times 2 times 3 = 2^2 times 3 $. In other words, the prime factors of 12 are 2 and 3.

Now, can we write 7 as a sum of these prime factors? Yes, we can: $7 = 2 + 2 + 3$. Okay, so far, so good. Can we write the number of empty spots as a sum of these prime factors? Well, $12-7 = 5$. And yes, we can also write 5 as a sum of 2s and 3s: $5 = 2 + 3$.

So, yes, we can balance 7 test tubes in a rotor with 12 spots! It’s likely this outcome wasn’t immediately apparent to you. If you were to see or draw a depiction and a working out of the arrangement yourself, however, I think it’ll become clear how this would work. Bonus points if you can draw a balanced configuration for 5 test tubes. Because you should know by now, you can.

Bonus trick

The beauty of it all is that all of the above does give us another quick way to assess whether we can balance the centrifuge. I’m going to be honest with you: it may be the easiest. If you can express the number of test tubes as the sum of two numbers of which you already know you can balance the rotor, then you can balance the rotor. Heh.

Final remarks

In real life, most machines have sensors to prevent force imbalances from taking over. The rotors have markings so that users won’t have to think about where to place the test tubes. Besides, in a university lab, you would simply make sure you prepare the number of samples which make a balancing act trivial. Moreover, many rotors contain three compartments containing sets of test tubes. This makes adjusting for mass variability much easier. And some machines, in hospital labs, for instance, have fully automated robots doing the heavy lifting.

Therefore, the reason for why this type of mathematics is done, isn’t so much for the applicability as it is for the joy of exploring deep connections such as between prime numbers and complex geometry, if you will. It’s first and foremost a fun and fruitful exercise of human exploration of the lands of number theory, algebraic geometry, and finite fields, on the continent that is pure mathematics.

Featured image by Michail Tzortzatos under CC BY-SA 4.0
Spinning rotor by user musicalwoods under CC BY-SA 2.0

  1. Although sensors may be installed to prevent the machine from operating in case of force imbalance. See also the Final remarks down below.[]