## You're reading: Travels in a Mathematical World

### Matrix multiplication doesn’t work like that

Earlier this week I posted a matrix multiplication worksheet on Mastodon.

If you do some of these, you might spot what’s funny about them. For example.

$\Large \begin{bmatrix} \color{navy}{4} & \color{navy}{8}\\ \color{navy}{2} & \color{navy}{3} \end{bmatrix} \begin{bmatrix} \underline{\color{blue}{8}} & \underline{\color{blue}{8}}\\ \underline{\color{blue}{2}} & \underline{\color{blue}{7}} \end{bmatrix} = \begin{bmatrix} \color{navy}{4}\underline{\color{blue}{8}} & \color{navy}{8}\underline{\color{blue}{8}}\\ \color{navy}{2}\underline{\color{blue}{2}} & \color{navy}{3}\underline{\color{blue}{7}} \end{bmatrix}$

That is, the answer to each question can be made by treating the element in the first matrix as the first digit and the corresponding element in the second matrix as the second digit in the answer element. This is not how matrix multiplication works, and ought to be funny if I hadn’t totally over-explained the joke!

I saw one of these in a meme that Katie posted in the Finite Group chat and it got me thinking about how these work.

If we set up the matrices like this

$\begin{bmatrix} a & b\\ c & d \end{bmatrix} \begin{bmatrix} e & f\\ g & h \end{bmatrix} = \begin{bmatrix} 10a+e & 10b+f\\ 10c+g & 10d+h \end{bmatrix}$

Then we establish four equations with eight unknowns.

\begin{align*} ae + bg &= 10a+e\\ af+bh &= 10b+f\\ ce+dg &= 10c+g\\ cf+dh &= 10d+h \end{align*}

Since there are more unknowns than equations, these don’t have a single solution. What I wanted was to find integer solutions with all values single-digits. I wrote some Python code to find these. I removed some that look overly symmetrical – either the rows of the matrix are identical, or the same matrix is repeated. This left 73 items.

From these 73 items, I wrote a second Python script that picks 20 of them at random and builds these into a LaTeX worksheet. For the Mastodon post I reformatted this into the shape and size that I thought would display better on social media, and added in one of the squared matrices for an extra hint something weird is up, hoping people might notice this isn’t just a boring post about matrix multiplication practice!

You can view these scripts and associated files on GitHub.

### Prime-generating functions

A few weeks ago I heard someone casually refer to ‘that formula of Euler’s that generates primes’. I hadn’t heard of this, but it turns out that in 1772 Euler produced this formula:

$f(x) = x^2 + x + 41\text{.}$

Using this, $$f(0)=41$$, which is prime. $$f(1)=43$$, which is also prime. $$f(2)=47$$ is another prime. In fact this sequence of primes continues for an incredible forty integer inputs until $$f(40)=41^2$$. It might generate more primes for higher inputs, but what’s interesting here is the uninterrupted sequence of forty primes.

This got me wondering. Clearly $$f(0)$$ is prime because 41 is prime, so that much will work for any function

$f(x) = x^2 + x + p$

for prime $$p$$, since $$f(0)=0^2+0+p=p$$. Are there other values of $$p$$ that generate a sequence of primes? Are there any values of $$p$$ that generate longer sequences of primes?

I wrote some code to investigate this. Lately, I’ve taken to writing C++ when I need a bit of code, for practice, so I wrote this in C++.

I figured the cases where $$f(0)$$ is prime but $$f(1)$$ isn’t weren’t that interesting, since $$f(0)$$ is trivially prime. In fact, $$f(x)=x g(x)+p=p$$ when $$x=0$$ for any prime $$p$$, but saying so doesn’t seem worth the effort.

So I kept track of the primes $$p$$ whose functions $$f(x)=x^2+x+p$$ generate more than one prime, and the lengths of the sequences of primes generated by each of these. This produced a pair of integer sequences.

I put the primes that work into the OEIS and saw that I had generated a list of the smaller twin in each pair of twin primes. I was momentarily spooked by this, until I realised it was obvious. Since $$f(0)=p$$ and $$f(1)=1^2+1+p=p+2$$, any prime this works for will generate at least a twin prime pair $$p,p+2$$.

What about the lengths of the sequences of consecutive primes generated? The table below shows the sequences of consecutive primes generated for small values of $$p$$. Most primes that generate a sequence produce just two, and $$p=41$$ definitely stands out by generating forty.

I was pleased to see this sequence of lengths of primes generated was not in the OEIS. So I submitted it, and it is now, along with the code I wrote. (I discovered along the way that the version where sequences of length one are included was already in the database.)

Anyway, I amused myself by having some C++ code published, and by citing Euler in a mathematical work. Enjoy: A371896.

### ChatGPT and history of maths misconceptions

You know how loads of things in maths are named for the wrong person? In 1996, a fun quiz appeared in The Mathematical Gazette based on history of maths misconceptions. It contained a series of questions where the obvious answer is not correct, such as “Who discovered Cramer’s rule?”, “Did Pascal discover the Pascal triangle?” and “Who first published Simpson’s rule?”

I was looking for a demo to show my students that generative AI programs are not producing accurate knowledge when I thought of this quiz. I put its questions to ChatGPT to see how it did. The point of the exercise is that these systems just parrot back words from their training data without any concept of truth, so if the training data is full of misconceptions, so too will be the responses. But these are misconceptions from the 1990s, so how much influence will they have on the responses?

You can see how ChatGPT did when I gave it the quiz in a short, free to read, open access paper in the British Journal for the History of Mathematics: Generative AI and accuracy in the history of mathematics.

### Primes, reversals and concatenations

In the last Finite Group livestream, Katie told us about emirps. If a number p is prime, and reversing its digits is also prime, the reversal is an emirp (‘prime’ backwards, geddit?).

For example, 13, 3541 and 9999713 are prime. Reversing their digits we get the primes 31, 1453 and 3179999, so these are all emirps. It doesn’t work for all primes – for example, 19 is prime, but 91 is $$7 \times 13$$.

In the livestream chat the concept of primemirp emerged. This would be a concatenation of a prime with its emirp. There’s a niggle here: just like in the word ‘primemirp’ the ‘e’ is both the end of ‘prime’ and the start of ’emirp’, so too in the number the middle digit is end of the prime and the start of its emirp.

Why? Say the digits of a prime number are $$a_1 a_2 \dots a_n$$, and its reversal $$a_n \dots a_2 a_1$$ is also a prime. Then the straight concatenation would be $$a_1 a_2 \dots a_n a_n \dots a_2 a_1$$. Each number $$a_i$$ is in an even numbered place and an odd numbered place. Now, since

$10^k \pmod{11} = \begin{cases} 10, & \text{if } k \text{ is even;}\\ 1, & \text{otherwise,} \end{cases}$

it follows that each $$a_i$$ contributes a multiple of eleven to the concatenation. A mismatched central digit breaks this pattern, allowing for the possibility of a prime.

I wrote some code to search for primemirps by finding primes, reversing them and checking whether they were emirps, then concatenating them and checking the concatenation. I found a few! Then I did what is perfectly natural to do when a sequence of integers appears in front of you – I put it into the OEIS search box.

Imagine my surprise to learn that the concept exists and is already included in the OEIS! It was added by Patrick De Geest in February 2000, based on an idea from G. L. Honaker, Jr. But there was no program code to find these primes and only the first 32 examples were given. I edited the entry to include a Python program to search for primemirps and added entries up to the 8,668th, which I believe is all primemirps where the underlying prime is less than ten million. My edits to the entry just went live at A054218: Palindromic primes of the form ‘primemirp’.

The 8,668th primemirp is 9,999,713,179,999.

### Announcing The Finite Group

“Wouldn’t it be nice if there was a place where maths people could hang out and create cool maths things?” This idea was put to me a couple of years ago, and has stuck with me. It does sound nice.

Fast forward to 2023, and social media is collapsing. Some people have chosen a direction and are marching off towards Mastodon, Bluesky, Threads, or a number of other platforms. Some people are trying to keep up with multiple of these, but feeling spread too thin and wondering if it’s worth the effort (ask me how I know!). But many people are taking the opportunity to step back and think again. People are rethinking whether they want to conduct their online social lives in public. There is a surge in private communities, things like WhatsApp groups, Slack channels and Discord rooms. These have the advantage that you aren’t part of the ‘engagement’-driven content push, but they have disadvantages too – you have to know the right people to get into the group.

Meanwhile, wouldn’t it be nice if there was a place where maths people could hang out and create cool maths things?

So we’re creating it. We’re calling it The Finite Group (who doesn’t love a punny maths name?). “We” is Katie Steckles, Sophie Maclean, Matthew Scroggs and me. It’s going to be a maths community that gets together to share and create cool maths things, that supports creators to do their work within the group and on the wider internet.

### Mathematical modelling and sustainability

I was interviewed by Nira Chamberlain, President of the Mathematical Association. I am the twelfth person to whom he has asked his question “what is the point of mathematics?” Hoping to offer something a little different, I spoke about teaching students the role mathematical modelling can play in sustainability.

### A visit to The Mathematikum in Giessen

My son and I visited The Mathematikum in Giessen. This is well worth a visit, we did it as a day trip by train from holiday in Frankfurt, which worked well because the museum is close to the railway station. The Mathematikum specialises in ‘hands on, minds on’ interactive activities, and we spent about 5 hours exploring the four floors. I enjoyed the open-access article The Mathematikum in Giessen by Martin Buhmann, who was kind enough to meet us and show us around.

There are some Mathematikum-made exhibits at MathsCity Leeds. I took some pictures of exhibits we had enjoyed that aren’t (to the best of my memory) available in Leeds. Here they are, in no particular order.