I’ve thought about number theory an awful lot recently, in preparation for the beginning of term, when I’ll be taking a 24 lecture course on it. So when I woke up this morning with a very strong desire to create something beautiful, it seemed natural to try to work with some of the number theoretic ideas I’ve been exploring.

It’s hard to know at what level to pitch this post since I think that anybody would be able to enjoy these pictures, but I also want to talk about group theoretic concepts where necessary. If you find yourself a little lost, I encourage you to gloss over the technical parts, as there still should be plenty for you to enjoy. If you’re keen, the Wikipedia articles on modular arithmetic and group theory are pretty good.

### Multiplicative Groups and Euler’s Totient Function

We define the **multiplicative group mod** **Euler’s totient function**. It’s pretty immediate that

For example,

and

and none of the other elements of

It is a nice property, then, that

Given this, we only need to understand the value of

### Cyclic Groups

It is remarkable to me, that for any prime

We know enough now to completely classify the multiplicative groups up to isomorphism. For example,

At this point, it feels like we’re sort of done with multiplicative groups. Cyclic groups are exactly the simplest type of group possible, and every multiplicative group is a direct product of cyclic groups. Thankfully, multiplicative groups have one trick up their sleeve which make them interesting.

### Generators of Multiplicative Groups

It turns out that, although we know that for a prime *too* hard. Applying Lagrange’s theorem to

However, things didn’t have to work out so nicely. We currently don’t know very much at all about the relationship between the prime factorisations of consecutive integers (apart from trivial facts like that one contains a 2, and neither factorisation shares the same prime). If we’d picked, say

There are a couple of tricks you can use to speed up the search, but even the best techniques are really not all that much more sophisticated than the above and are still dependent on the particular prime you choose.

*It may come as some solace to find out that if you just pick at random, you have a pretty good chance of getting a generator – half of the elements of the group are generators.*

### Cayley Tables

So while the Cayley table of a cyclic group is in general pretty boring:

the Cayley table of

I’ve generated the following images by finding the invertible elements of

For example, here’s the Cayley table for

Let’s explore.

### Prime Numbers

I have sat and thought about what to write in this paragraph for some time, but I just can’t explain how I feel about the following pictures in words. I’ll try. I find these patterns incredibly beautiful. They have so much internal symmetry. In some sense, they are random, but in another, they are exactly what they always had to be. There is no universe where these tables look any different from the ones below. The pictures which follow are exactly why I love mathematics so much, and I hope that you can appreciate their elegance despite my inability to tell you exactly what about them it is that I like.

Here are the multiplication tables for the primes 3, 7, 13, and 19.

As we get higher and higher up, more and more interesting patterns emerge. Here is the table for the prime 113:

and 997, the largest 3-digit prime number:

Here’s one for 9973, the largest 4-digit prime number. It’s a largish file (18MB), so be warned. Your monitor might struggle to give you a good impression of what it looks like.

### Composite Numbers

Perhaps the only tables more beautiful than the ones for the primes are the ones for the composites. Here’s 105 sandwiched between the primes 103 and 107.

Here are 15 and 16:

At first glance, they appear completely different to each other, but they are not. No:

In the following images, I’ve picked out a copy of

Now, some numbers with lots of factors. Let’s start with 24 and 36:

Here’s 120:

These start to look pretty crazy pretty quickly. Here are 1260, 2520, and 27720 (35MB).

### Powers of Two and Fermat Primes

The last few pictures I want to share with you are related to powers of two. As I mentioned before, the powers of two don’t follow quite the same pattern as the other primes, since for

A **Fermat prime** is a prime of the form

Here are 3 and 5:

And here are 8 and 16:

These are 17 and 64:

And here’s 1024. I’m sure you can imagine what 257 must look like.

### Conclusion

I hope you’ve enjoyed this foray into modular arithmetic. I’m sure there are many, many more interesting things to notice than the brief comments that I’ve made above. As such, if you would like me to post particular images, do mention them in the comments and I’ll provide them.

I’ll leave you with one of my favourites (48):