## You're reading: Posts Tagged: oeis

### 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.

### 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.

### Bouton numbers: a new integer sequence

In the 1901 paper that named the game Nim and provided its mathematical analysis, Charles Bouton defined “safe combinations”, positions that if you leave the game in this state, your opponent cannot win. In combinatorial game theory, these are $$\mathcal{P}$$ positions (the previous player has already won), as opposed to $$\mathcal{N}$$ positions (the next player can win).

Bouton gives a list of “the 35 safe combinations all of whose piles are less than 16”, working in three-heap Nim. Naturally it seemed sensible to check these, so I wrote a bit of Python code to do this. Bouton’s list is good. I realised I could easily adapt my code to find out how many $$\mathcal{P}$$ positions there are for three-heap Nim games with other maximum heap sizes: 1, 2, 3, and so on.

And, having generated a sequence of integers, I naturally looked to see if it was in the OEIS. This is sometimes a good way to discover that your sequence of numbers is also found in some unexpected places. It wasn’t there! So I submitted it, and I just got the exciting email “N. J. A. Sloane published your changes”. So I present A363166: “Bouton numbers: a(n) is the number of P positions in games of Nim with three nonzero heaps each containing at most n sticks”.

This is my first OEIS submission, so it’s all very pleasing, even if I’m submitting a ‘new’ sequence inspired by a 1901 paper!

### Aperiodical News Roundup – June 2021

Here’s a round-up of mathematical things that happened in June, and things you might want to know about that are happening in the future!

## News

#### News In Brief

• YouTuber and PhD physicist Derek Muller (Veritasium) has recently been involved in a physics-off with UCLA professor Alexander Kusenko, when they disagreed over the explanation behind a physical phenomenon, which escalated to a $10,000 bet over who was right. Long story short, Veritasium won the bet (as covered in this IFLScience news story) and will be using the money to fund a science communication contest. If you’ve got an under-a-minute maths/science video you can post on YouTube or TikTok, you could win a prize of up to$5,000. Props to Derek for encouraging more STEM communication and promoting new talent!
• It’s been formally announced that Neil Sloane is stepping down as president of the OEIS – Russ Cox will take over presidential duties, while Sloane steps down to Chairman of the Board so he can dedicate more time to his writing projects (which we’re assured ‘naturally involve sequences’). Cox has been involved with the OEIS for over 25 years and has been a major contributor to the backend software that makes the site run, so he’s a safe pair of hands to take the project on.
• The eleven 2021 LMS Prize winners were announced at the Society’s Meeting on 2nd July, and the prizes recognise contributions to mathematics in a variety of areas. (via @LondMathSoc)

#### Alan Turing £50 note launches

On 23rd June the new Alan Turing £50 note was launched, featuring an image of Turing, a quote and various mathematical diagrams. Bletchley Park marked the occasion with a #Turing50Takeover, and the Bank of England has a whole page of info about the new polymer note on their website.

Meanwhile, in Turing-adjacent news, the National Museum of Computing has launched an online Virtual Enigma machine you can use to simulate the device behind the famous Enigma code, along with a video explaining the machine. This joins a host of other virtual historical computers they’ve built, including the Colossus that cracked the code, the Lorenz machine and even ERNIE the random number generator!

#### Claimed proof of Riemann Hypothesis

Another claimed proof of the Riemann Hypothesis, this time by Kumar Easwaran, emerged this month, and since like all big claims it would need thorough checking before acceptance by the mathematical community, there was some initial skepticism. (This didn’t stop the media from latching on to it as an exciting story though). Since claimed proofs of Riemann are like buses, many mathematicians don’t give them much attention, but Alex Kontorovich took the time to thoroughly debunk this one to save you the trouble.

If you want some actual Riemann Hypothesis news, here’s some: John Baez reports that Alain Connes and Caterina Consani have made some potential progress on part of the problem. In the words of Baez, “my interest is piqued”.

Thuses is a website for mathematicians to publish and discuss ideas of interest to the mathematical community. It’s described as “a perfect place to share new approaches, slick proofs, and surprising counterexamples. A place for ‘folklore results’ that are considered known but don’t actually exist in literature. A place for everything in math that just has to be shared.” (via Piper H)

The Royal Society has published a set of papers on modelling that shaped the early COVID-19 pandemic response in the UK as a special journal issue that’s free to access.

The BSHM (British Society for the History of Mathematics) has launched the Bibby Awards in the History of Mathematics, for “contributions to the popularization of the history of mathematics in education”. Named after (and funded by the legacy of) the late BSHM member Neil Bibby, up to four awards of £400 can be made each academic year, in return for which holders are expected to give two free talks in schools and produce four digital resources (videos, PDFs or interactives) for the BSHM website. (via Sarah Hart)

## Events

The Isaac Newton Institute in Cambridge is hosting The unity of mathematics: A conference in honour of Sir Michael Atiyah which will take place in September 2021 as a hybrid event with a mixture of in-person and virtual talks. The closing date for registration for physical participants is 8th August.

There’s just about still time to register for the People, Places, Practices History of Maths Conference (registration closes 9th July) taking place 12-15 July online (coordinated by the University of St. Andrews). With around 90 speakers contributing, the programme looks packed, and talks will be available to watch ahead, or at the specified time to be followed by a live Q&A.

Alexandre Borovik reports on his blog about Azat Miftakhov day, an event organised online by the Azat Miftakhov committee in solidarity with Azat Miftakhov – a graduate student from Moscow State University who was sentenced to six years in a medium-security penal colony and has already been arbitrarily detained by Russian state authorities for almost two and a half years. Fields medalist Cedric Villani made a speech at the event, and you can watch videos from the event on YouTube.

### Dani’s OEIS adventures: triangular square numbers

Hi! I’m Dani Poveda. This is my first post here on The Aperiodical. I’m from Spain, and I’m not a mathematician (I’d love to be one, though). I’m currently studying a Spanish equivalent to HNC in Computer Networking. I’d like to share with you some of my inquiries about some numbers. In this case, about triangular square numbers.

I’ll start at the beginning.

I’ve always loved maths, but I wasn’t aware of the number of YouTube maths channels there were. During the months of February and March 2016, I started following some of them (Brady Haran’s Numberphile, James Grime and Matt Parker among others). On July 13th, Matt published the shortest maths video he has ever made:

Maybe it’s a short video, but it got me truly mired in those numbers, as I’ve loved them since I read The Number Devil when I was 8. I only needed some pens, some paper, my calculator (Casio fx-570ES) and if I needed extra help, my laptop to write some code. And I had that quite near me, as I had just got home from tutoring high school students in maths.

I’ll start explaining now how I focused on this puzzle trying to figure out a solution.

### Integer Sequence Review – Sloane’s birthday edition!

The Online Encyclopedia of Integer Sequences contains over 200,000 sequences. It contains classics, curios, thousands of derivatives entered purely for completeness’s sake, short sequences whose completion would be a huge mathematical achievement, and some entries which are just downright silly.

For a lark, David and I have decided to review some of the Encyclopedia’s sequences. We’re rating sequences on four axes: Novelty, Aesthetics, Explicability and Completeness.

CP: It’s Neil Sloane’s 75th birthday today! As a special birthday gift to him, we’re going to review some integer sequences.

DC: His birthday is 10/10, that’s pretty cool.

CP: <some quick oeis> there’s a sequence with his birthdate in it! A214742 contains 10,10,39.

DC: We can’t review that. It’s terrible.

CP: I put it to you that you have just reviewed it.

DC: Shut up.

CP: Anyway, I’ve got some birthday sequences to look at.

CP: No.

#### A050255 Diaconis-Mosteller approximation to the Birthday problem function.

1, 23, 88, 187, 313, 459, 622, 797, 983, 1179, 1382, 1592, 1809, 2031, 2257, 2489, 2724, 2963, 3205, 3450, 3698, 3949, 4203, 4459, 4717, 4977, 5239, 5503, 5768, 6036, 6305, 6575, 6847, 7121, 7395, 7671, 7948, 8227, 8506, 8787, 9068, 9351

### Discovering integer sequences by dealing cards

Let’s play a game:

1. Imagine you have some playing cards. Of course if you actually have some cards you don’t need to imagine!
2. Pick your favourite natural number $n$ and put a deck of $n$ cards in front of you. Then repeat the next step until the deck is empty.
3. Take $2$ cards from the top of the deck and throw them away, or just take $1$ card from the top and throw it away. The choice is yours.

If you pick a small $n$, such as $n=3$, it’s pretty easy to see how this game is going to play out. Choosing to throw away $2$ cards the first time means you’re then forced to throw away $1$ card the next time, but only throwing away $1$ card the first time leaves you with a choice of what to throw away the next time. So for $n=3$ there are exactly $3$ different ways to play the game: throw $2$ then $1$, throw $1$ then $2$, or throw $1$ then $1$ then $1$.

Now, here comes the big question. How does the number of different ways to play this game depend on the size of the starting deck? Or in other words, what integer sequence $a_0$, $a_1$, $a_2$, $a_3$, $a_4$, … do we get if $a_n$ represents the number of different ways to play the game with a deck of $n$ cards? (We already know that $a_3=3$.)