Hi! My name is Colin, and I am a PROPER mathematician now. I’ve made a contribution to the Online Encyclopaedia of Integer Sequences.

## The OEIS

If you don’t know about the OEIS, then congratulations! You’re one of today’s lucky 10,000. Except for possibly Wikipedia, the OEIS is probably the most important and useful mathematical community resource on the internet. The main use case is, you’re doing some maths and you find a sequence. You wonder whether it’s something new or interesting. So you type it in to the OEIS search bar, and if it exists, you’re told what it is, whether there are formulas for it, different suggestions of where it crops up, lists of terms… it’s like a Who’s Who of number sequences.

There’s seemingly no limit to what it contains. For example, it contains the decimal form of the n-th color mentioned in the song “I Can Sing a Rainbow”, which I would call borderline “not maths at all”. At the other end of the spectrum (ahahaha), it also contains the all 1s sequence, which is borderline “not a sequence at all”. The idea seems to be “if it’s a reasonable sequence someone has ever had cause to think about, it belongs here”.

Now, I’m very fond of saying I’m a mathematician. I have two degrees, several academic papers, a number of published books, an equation named after me and no proper job. But at the same time, my impostor syndrome insists that a *proper* mathematician would have at least *something* in the OEIS.

I am now doubting whether I really qualify as an impostor.

## The question

This all started — as most of my maths seems to these days — from a question posed by my 10-year-old, Bill.

“Does Pascal’s triangle go

upthe way, too?”

If you’re not familiar with Pascal’s triangle, then congratulations! Etc. You might want to visit Matt Enlow’s piece on it in the Math-off final.

Meanwhile, here are the first few rows:

\[ \begin{array}{ccc ccc ccc ccc ccc}

&&&&&&& 1\\

&&&&&& 1 && 1 \\

&&&&& 1 && 2 && 1 \\

&&&& 1 && 3 && 3 && 1 \\

&&& 1 && 4 && 6 && 4 && 1 \\

&& 1 && 5 && 10 && 10 && 5 && 1 \\

&1 && 6 && 15 && 20 && 15 && 6 && 1 \\

1 && 7 && 21 && 35 && 35 && 21 && 7 && 1 \\

\end{array} \]

Translating that into how boring grown-up mathematicians speak, he was asking whether you can add rows *above* the 0th row — what would the -1st row look like? The -5th?

We had a good chat about this — how we could change the rules slightly to make it work, but remain consistent, what patterns he could find, and eventually he wandered off with a pad of paper to see what he could fill in for himself.

I *was* going to ask him about what would happen with fractions, before I nerdsniped myself asking “what would happen with complex powers? What’s the \( i\)th row of Pascal’s Triangle?”

There’s a trick for generating the \( n \)th row of Pascal’s triangle:

- Let your current entry be 1 and your fraction be \( \frac{n}{1} \).
- Write down your current entry.
- Multiply it by your fraction to get a new current entry.
- Subtract one from the top of your fraction and add one to its bottom.
- Go back to step 2 until either your entry becomes 0 or you get bored (or both).

So, for example, the fourth row would be:

- Write down 1, and multiply by \( \frac{4}{1} \).
- Write down 4, and multiply by \( \frac{3}{2} \).
- Write down 6, and multiply by \( \frac{2}{3} \).
- Then 4, 1, and 0 — so we stop.

We get the numbers 1, 4, 6, 4, 1, as we would have hoped.

This also works for non-natural numbers. We could find the -3rd row to answer Bill’s question:

- Write down 1, and multiply by \( \frac{-3}{1} \).
- Write down -3, and multiply by \( \frac{-4}{2} \).
- Write down 6, and multiply by \( \frac{-5}{3} \).
- Then -10, 15, -21, and we get bored so we stop.

We get the numbers 1, -3, 6, -10, 15, -21 and can hypothesise or prove that these are the triangular numbers with alternating signs.

## So what about the \( i \)th row?

Well, it works just the same way, only with slightly trickier calculations.

- Write down 1, and multiply by \( \frac{i}{1} \)
- Write down ( i ), and multiply by \( \frac{i-1}{2} \)
- Write down \( \frac{-1 – i}{2} \), and multiply by \( \frac{i-2}{3} \)
- Honestly, I’m bored already. We have machines for this sort of thing.

It’s also a lot easier if we just ignore the bottom of the fraction — it’s trivial to say “we need to divide the \( k \)th term by \( k!\),” and it doesn’t affect the working out at all.

And if we do that, we get a Gaussian integer sequence:

\[ 1, i, (-1-i), (3+i), -10, (40-10i), (-190+90i), \dots \]

Now, the OEIS, like any good hip-hop artist, prefers to keep it real. You are as likely to find Gaussian integers in the OEIS as in the work of Grandmaster Flash (who is surprisingly mediocre at chess). However, I reasoned, the real and imaginary parts might be there separately.

And boom, there they were:

## Wait. What?

The OEIS is useful not just as a research tool, but as an educational tool: it’s forever throwing up unexpected links and ideas and threads to pull at. Here, for example, it raises the question “what on earth is an e.g.f.?”

Luckily, Wikipedia is also a useful research and educational tool: the e.g.f. is the exponential generating function. Let’s start with a sidetrack into (common or garden) generating functions, which are the sort of dark magic it’s worth messing about with.

A generating function is a way of turning a sequence of numbers into a function, the better to understand its properties. For exampe, if you take the Fibonacci sequence, with terms 0, 1, 1, 2, 3, 5, …, the associated generating function is

\[ g(x) = 0 + 1x + 1x^2 + 2x^3 + 3x^4 + 5x^5 + \dots \]

Generating functions make certain manipulations very simple: for example, you can “move the sequence along” if you multiply by a power of \( x\). As a result, you can use the definition of the Fibonacci sequence to find that \( x^2 g(x) = x g(x) + g(x) \) — each term is the sum of the previous two — and rearrange to find that \( g(x) = \frac{1}{x^2 – x – 1} \). As a result, you can say “Let’s put \( x = 100 \) into that” and find that \( \frac{1}{9,899} = 0.00 01 01 02 03 05 08 13 \dots \) . (After a while, the carries get in the way and break the sequence.) There are all sorts of cool applications in number theory and probability.

In particular, the binomial expansion of \( (1 + x)^n \) is the generating function for the \( n \)th row of Pascal’s triangle — that is, the coefficient of \( x^k \) in the generating function of the \( n \)th row is \( nCr(n, k) \).

So what about the exponential generating function?

Rather than taking the coefficients from \( a_0 + a_1 x + a_2 x^2 + \dots \), the e.g.f. takes its coefficients from \( b_0 + b_1 x + b_2 \frac{x^2}{2!} + b_3 \frac{x^3}{3!} + \dots \). It’s the same idea, but the manipulations are slightly different (you shift by differentiating or integrating, for example.)

When we’re looking at the \( k \)th element of a row in Pascal’s triangle, it’s the same as multiplying the coefficient by \( k! \) — or rather, you get \( nPr(n, k) \) .

So: what I worked out above, the Gaussian integer sequence, is the e.g.f. of \( (1 + x)^i \).

## And where does trigonometry come into it?

It wasn’t immediately obvious to me how that was linked to the OEIS sequence, until I took a few minutes to work it through.

If we combined the sequences to make the Gaussian integers, we’d get \( \cos( \ln(1+x)) + i \sin(\ln(1+x))\). And that’s a familiar form: \( \cos(z) + i \sin(z) \equiv e^{iz} \).

So our sequences combine to make \( e^{i \ln(1+x)}) \), which works out to be \( (1+x)^i \). Lovely!

And lastly, the permutations observation from before means that each term can be written as \( nPr(i, k) \).

There’s a slight wrinkle, though: it’s not exactly reasonable to pick \( k \) items from a set containing \( i \) of them. Even the formula of \( nPr(n, k) = \frac{n!}{(n-k)!}) \) isn’t well-defined: you can’t *really* take the factorial of something that isn’t an integer.

However, there’s a handy generalisation of the factorial function to all complex numbers, the gamma function, defined such that \( \Gamma(n+1) \equiv n! \) on the natural numbers.

As a consequence, we can extend the permutation function in a similar way: on the natural numbers, \( nPr(n, k ) \equiv \frac{\Gamma(n+1)}{\Gamma(n+1-k)}) \), and (having checked with the Mathematical Authorities), we’re allowed to use that definition for all complex numbers (apart from the unnatural integers, where \( \Gamma(x) \) is undefined. But that’s for another day.)

Where were we? Oh, yes. Each term of our Gaussian integer sequence is \( nPr(i, k) \), which we can write as \( \frac{\Gamma(i+1)}{\Gamma(i+1-k)}) \); the two sequences correspond to the real and imaginary parts of this.

And *that* formula, or anything like it, was missing from the OEIS.

Now it isn’t, and I can finally cut up my impostor card and say with confidence: my name is Colin, and I am a mathematician.