post

In conversation with Christopher Lillicrap

Out in the Mexican desert, the villagers cheer. Little Juan has scratched a line in the sand. His mama beams with pride. His mentor nods solemnly at this creation.

“Thank you, El Nombre,” Juan says, wide-eyed. “That is the best ‘one’ I have drawn.”

From beneath his sombrero and Zorro mask, El Nombre delivers his verdict.

“And it’s a good one, Juan. Just make sure it’s not your last one, Juan.”

And with that, a rope swings in from nowhere. The masked hero grabs hold, swoops into the air, and disappears to the sound of trumpets. Until, of course, he is summoned next episode when Juan is ready to learn the number two.

For 90s kids, this is how the BBC taught us to write numbers. Originally a two-minute sketch within the award-winning primary school series Numbertime, the stop motion parody El Nombre quickly became a breakout hit. Each mini-episode saw our masked hero swoop in to solve the village’s mathematical problems, always to the tune of the Mexican hat dance. And did we mention everyone in these stories is a gerbil?

Rewatching them now—many are on YouTube and BBC iPlayer—there’s so much joy in how entertainingly daft the jokes are. Wordplay, slapstick, parodies of western film tropes. Surely we didn’t appreciate this as three-year-olds?

“The trick,” says Christopher Lillicrap, creator of Numbertime and many other children’s shows, “was to entertain the teachers. They’d be the ones forced to watch the same episode on loop. If they laughed, they’d keep putting it on for the kids.”

Now spending time in Greece and bringing out new music—he composed the music in the show as well—Chris has agreed to sit down with us and reminisce about making television shows for children, while we try to fill in the lore of this seminal education experience.

Left: Douglas Fairbanks as Zorro (1920). Right: A gerbil.

Left: Douglas Fairbanks as Zorro (1920). Right: A gerbil. Combine these two things, add some stop-motion puppetry, and you have El Nombre.

Something, educate and entertain

In retrospect, it’s obvious why Chris put himself in the teachers’ shoes. “I was a teacher in a former life. I’d been told at grammar school, you see, that I couldn’t go and be an actor—I should get a proper job. Go and teach drama, they said. That’ll get it out of your system.”

So after three years of teacher training college, he landed a job at a tough secondary modern school in Mansfield. “At one point I had to separate two hulking great teenagers having a fight in the library. I found out the week after I left, one of them put an axe through his dad’s head. It was that kind of school.”

But he discovered quickly that if he entertained his students, he could teach them better. “We could do unconventional things. Once, the headmaster came walking through the hall while I was doing drama with the kids, and I had them playing football. But the whole thing was mimed! He eventually noticed there was no ball. ‘How did you do that?!’ he asked.”

Despite the ‘proper job’ leanings of his own teachers, Chris points to their positive influence: “I had an English teacher called Mr Jefferson. And one week I wrote this essay about an alien professor—I called it ‘Once There Was Man’. The professor was explaining about Earth: once there was man, but he wiped himself out. Well, Mr Jefferson insisted on standing up and reading it to the class: he had shown it to his wife, who thought it was absolutely brilliant. That was the moment I thought, hang on, I can write things.”

And given his career trajectory, surely mathematics was also a triumph? “I was abysmal at maths. It amuses me now that with Numbertime, we ended up winning a Royal Television Society award—but for a subject I was useless at! I failed my CSE maths.” But with one teacher, he made real progress. “When I was 14, we had Mrs Carter—oh no!” She had a reputation for being extremely strict. “But I had a completely different opinion of her once I got to know her! I went from 22nd in the class to fifth. Suddenly I understood some stuff!”

And there were at least some cheerleaders for Chris’s dramatic ambitions: “We’d put on The Pirates of Penzance. One night, two very drunk teachers came up to me and said, ‘Lillicrap, if you don’t go on the stage, we’re gonna hunt you down and kill you.'” This thought came back to him after a year teaching in Mansfield. “I thought, sod it. I’m gonna go do what I want!”

So Chris took a massive pay cut to drive a van for a children’s theatre company. “You got an extra fiver if you drove the van. So I was on the princely sum of £25 a week.” From there, he moved into repertory theatre, in the company of Zoë Wanamaker and (now Sirs) Jonathan Pryce and Richard Eyre. “It was fabulous, we even had our own football team”.

Eventually, television called, although initially inauspiciously. “I auditioned for Play School. I knew I’d done a brilliant audition—the camera crew were falling about. I thought, I’ve cracked this.” Then came the rejection letter. “Years later, I asked why. They said: you were far too interesting. You didn’t just sit there and say ‘what’s through the round window?’ and sit quietly for ten minutes.”

Luckily, Judy Whitfield, a producer at the BBC, had seen the same audition. “She phoned up and said she was doing a new programme called Playboard. Would I like to present it and write the songs? This was 1976—a really hot summer, not that I noticed, I spent six weeks inside a studio and then it rained.”

A B&W photo of Chris in a hat sitting at a large drum. There are thick vertical stripes behind him reminiscent of a circus tent

Chris’s first programme for the BBC was the 13-episode series Playboard in 1976. Broadcast mostly on Sunday mornings and aimed at under-fives, the show featured puppets and was set in a fairground; Chris would tell stories and sing songs. The puppets themselves had their own theatre tours. Photo: Chris Lillicrap

It was the start of a long career in children’s television, creating and presenting We’ll Tell You a Story and Flicks—shows based on reading books—which together ran for ten years. This put him on both sides of the BBC–ITV divide, a rarity in the days when crossing channels was almost unthinkable. “When Morecambe and Wise left the BBC for ITV, it was front page news. People didn’t cross. But somehow I did. And no one seemed to notice.”

The… Name?!

After presenting gigs began to dry up—“I was getting old, you know, I was over 30!”—Chris moved into writing and was offered Numbertime. “The original first series was, at heart, back to the 60s. It was a sketch show, Monty Python or Not the Nine O’Clock News, but for kids. I remember sitting at the kitchen table all night thinking: we could do with some animation in the middle. I came up with a sort of Zorro idea, but of course we can’t call him Zorro. I land on El Nombre.” At this point, Chris acknowledges the elephant in the room. “Which is stupid, because nombre doesn’t mean number at all in Spanish! It’s a complete misnomer!”

But the stories became a very good way of making concepts relatable. “We could do things like fractions, because, hang on a minute, what does Little Juan like? Pizza? Everybody wants a different topping? So they divide the pizza up into halves and thirds. And that was how it started.”

El Nombre eventually outgrew Numbertime and became its own series. “Children’s BBC had said, yes, they’d like us to do an El Nombre spinoff, but they wanted no education in it whatsoever. This was in a meeting at Television Centre between me, the head of children’s and the head of education: powerful women you wouldn’t want to argue with.” Somehow, Chris ended up refereeing. “‘Well,’ said the head of education, ‘there’s got to be some educational content.’ I said, ‘When this meeting finishes, I may or may not have a job…! So how about we agree there will be no overt education in it, but a bit like Sesame Street, a few things might creep in.’ And of course they did.”

The big argument

Readers might expect counting to 10 to be uncontroversial, but you’d be wrong. “We had a big argument about whether we include zero or not. Because Numbertime had 10 programmes planned. It’s obvious, isn’t it? One to 10. But our educational adviser said we need to start with zero—inclusive counting, they called it. Well, that’s 11 programmes! And I thought, well, we can’t start with nought—try writing a programme about nothing! In the end we slipped in the fact that if we take one away from one, we’ve got nothing. I think that was the end of the argument.”

Other arguments were more surreal. “There was a wedding in one episode, and I remember a long discussion over whether Little Juan should wear sandals or be barefoot—this was a big cultural thing. I pointed out that he’s a gerbil and, well… that threw a spanner in the works.” Another time, “we wanted to do a Halloween episode, dividing up pumpkins, but at the time the BBC was worried it was too occult”.

Sometimes technical issues provided narrative challenges. “As the writer, you’re contracted to write 10 scripts and you’re paid per script, but there’s a separate budget for the animation company. So there would be a conversation—what if I want to do aliens, space lasers or blow things up? Once I was told I’d put something in the script which was a big problem… water! Because in stop frame animation, it is! But they said to leave it with them and they came up with a way of doing it.”

With experience, Chris mastered the politics of script approval. “I learned this when I was doing my first series for Thames Television: if you want to sneak something in, put something more outrageous just before it. Always give the producer something to put a pencil through. Then they’ll ignore the bit you really wanted to get in.”

Sometimes the producers are probably right, though. “There was an episode of Rainbow I wrote, called Long, Longer and Longest. Jeffrey and Bungle were rolling out pieces of plasticine and comparing lengths. Well, only when we’d got to the point of recording did we suddenly realise what it looked like. Cut!” The episode never made it to air.

Oh no, he doesn’t

So does Chris recommend his career journey? “No! My wife, Jeanette, and I produced pantomimes, and we’d always have children in it. You’d get the mum come up to you who thinks her daughter’s going to be Bonnie Langford and she’d ask for advice to get her daughter into acting. And I would always say, ‘discourage every possible opportunity!’ Ninety-five percent of the acting profession is unemployed at any time. This business is 90% luck and 10% talent. Even if you have the 10%, you still need luck.” He recalls friends who visited him during a run of The Lion in Winter. They asked what he was doing next. “I said I didn’t know. Maybe a commercial in the Caribbean, maybe nothing. That’s the life. ‘Well, what about your mortgage? How do you sleep at night?’—Well, sometimes I didn’t!”

Children’s TV at least provided some stability. “The great thing about the education stuff was that you’d have a contract that allowed for repeat fees. So you’d get paid several times over by the seventh showing. And people are watching it in Nigeria, in Israel and in Australia.” Between Chris and his wife, they kept things going: “Usually, when one was working, the other wasn’t, but sometimes neither of us were, which is when we then started writing shows and plays, and started producing, because if you just did one thing and sat and waited for the agent to phone, you could sit for a very long time.”

Numbertime ran for eight years and the El Nombre series was formed of 24 episodes. “I mean, it came back to bite me some years later. I was filming a different series in Coventry and this teacher comes storming over: ‘Christopher Lillicrap! I’ve got a bone to pick with you! If I hear that song—1, 2, 3, 4, 5, 6, 7… 8, 9, 10—again, I’m gonna throw up!’ I said I was terribly sorry. She said, ‘Your only saving grace is that by the end of term, all my class can count to 10!’ Now, at that point, of course, the children don’t know how they’re counting to 10. That’s the bit the teacher does. I’ve just lit the fuse.”

The music to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

“They’re all going around the playground, singing it!” Now you, too, can enjoy the soundtrack to our childhood.

Music in Monastiraki

When Chris and Jeanette retired, they started spending more time in Greece. A new era of creativity beckoned, culminating in Chris releasing an album of eleven songs—“an eclectic mix!”.

“I became used to, over the years, writing songs for a purpose. But musically, I didn’t realise that I didn’t write anything unless somebody said. So with the album, I suddenly started writing things, not for children. Apart from the one track my grandchildren love. Somebody during lockdown wrote to me and said, did I have a copy of it? Because his daughter wanted it at her wedding. The song’s called Eric the Whale, and the chorus is ‘Yo ho ho, yo ho ho, I’m Eric the Whale, that’s me’. Of course I sent them a copy, but I thought the groom’s gonna get a bit of a shock.”

A young Chris Lillicrap standing in a yellow coat and jeans, playing a red guitar

Chris’s pride and joy, seen here—a cherry red sunburst Ibanez guitar—was cracked in a railway platform/breeze/gravity interface incident. In the midst of the pandemic, 40 years later, he found a 12-string 1970s original in a Greek market. Buying it brought him back to writing songs after 20 years. Photo: Chris Lillicrap

By chance, in an old music shop in Athens, Jeanette had spotted a cherry sunburst guitar hanging on a wall. It was an Ibanez, just like the model Chris had owned but damaged 40 years earlier, when a gust from a passing train knocked it over (the BBC refused to cover it—a ‘foreseeable accident’.) The model had been discontinued but now, against all odds, here was a perfect replacement—and a 12-string as well. He bought it, and soon after, songs started to flow again. Funny ones, like I’ve Got an App for That (a woman marries a Samsung Galaxy), nostalgic ones, like The Good Old Days (a patchwork of 1960s lyrics), and poignant ones, like You Will Be Me—“an old friend liked the implied threat to young people!”. You can watch the video for the latter on YouTube.

So he recorded the songs, shared them around, and at the age of 76, was invited to sign a record deal. “A friend said at this age, it must be some sort of record.” But surely Captain Tom still takes some beating? “But he didn’t have an album. And I’m not having Michael Ball sing on mine!”

Keep counting

So how much maths is left in his life? “Every morning, I look at the exchange rate. For pensioners abroad, it actually matters—the chancellor says the wrong thing, and we’re all so much worse off. The biggest thing has been, dare I say, the dreaded B-word. I used to get €1500 for £1000 and this morning I can get €1130. That’s a big difference.”

Chris remains amused, but also rightly proud, that despite failing his CSE maths exam, he has taught generations how to count. “It’s interesting, you don’t realise the impression that maybe you make.” Chalkdust readers might agree with his philosophy of ‘entertain, and they learn something’.

But to the serious business—would El Nombre pass GCSE maths today? “Of course. He’d be insulted to have to take it. Little Juan, I’m not so sure. Maybe I’d be passing notes through the window.”

And where did the characters end up? “Mexico! Or probably in a cupboard somewhere. I had Little Juan at one time. I must have a look upstairs and see if he’s still around.”

Whatever their fate, one thing is clear: El Nombre never taught anyone Spanish. But thanks to Christopher Lillicrap, a generation of children learned something just as valuable: that numbers can be fun.


Chris’s album—What Ever Happened To—is out now, published by Wienerworld. The lead song, You Will Be Me, is available to watch on YouTube. He blogs at chrislillicrap.com.

post

Microbe wars

The word origami comes from the Japanese ori (to fold) and kami (paper). From its origins in Japan, origami has surged in popularity; according to the Guinness World Records, the largest paper crane has a wingspan of 81.94m and the largest display of origami hearts is 3,917,805—even as a mathematician, I wouldn’t want to count all of those!

You may have even tried origami yourself. Perhaps you’ve impressed your friends at dinner with a carefully-folded napkin, or used one of your lecturer’s problem sheets to make a paper plane. However, I can bet one thing you haven’t tried to make your origami from is DNA.

Antimicrobial resistance is the developing resistance of bacteria and microbes to antimicrobial treatments. It is problematic as it could result in antibiotic treatments being less effective. Fortunately, not so long ago in a galaxy not that far away, scientists began experimenting with DNA nanotechnologies for targeted drug delivery. Long strands of DNA can be folded into ‘origami’ with specific shapes suited for direct delivery of the drug to the bacteria.

For example, in one experiment, origami were engineered with wells that carried compounds of an antimicrobial enzyme called lysozyme. These were surrounded by sticky filaments that attached to microbes, ensuring the enzyme was delivered where it was needed. The origami is folded into structures called origami frames.

In this experiment, red E. coli is surrounded by green DNA origami. Image: Ioanna Mela.

DNA is an example of a filament bundle. Filament bundles are abundant in the body and are crucial for both structure and motility. The eyes with which you are reading this article transmit information to the brain through the optic nerve bundle; as you go to reach for a sip of your tea you are using muscles in your arm composed of collagen bundles. Even when you are sitting completely still, neurons in the brain and filaments involved in cell division are busy at work!

Mathematical modelling can play an important role in supporting experimental advancements of this nature, improving our understanding of the dynamics of these structures in vivo. Having said that, biology is complicated and one of the challenges in building a mathematical model is trying our best to keep enough biological detail for realistic simulations, but not too much as to make the model overcomplicated or too computationally costly. This is where an unlikely hero joins our story: energy minimisation.

Bundles within the body are subject to various forces, and under extreme forcing they can deform. For effective drug delivery, it is crucial that the origami frame remains bound to the bacterial membrane; bacteria are less likely to survive direct application of the drug, than if the drug were freely administered into the surrounding fluid. Filament models are one way in which we can build an understanding of how the origami frame responds to forcing, and the use of energy minimisation will help us keep the model under computational wraps.

Join me as we venture through the saga to start your training in filament modelling. Don’t miss the Easter egg on page 45 of the magazine to master making your own origami heart!

Modelling a filament

The first episode in our mission to mathematically model these filaments is to simplify the problem. As with all good models, we make something super simple before adding the complications. One way in which to do this is by considering relevant length scales. The length of a filament is much greater than its radius (with a difference spanning nine orders of magnitude). This gives us a good reason to model it as a one-dimensional rod, which we take to be an open, discrete curve. For computational simplicity we then discretise the curve into $n$ segments, like this:

A discrete rod; point $j$ on rod $i$ is indexed by $ij$.

If we so wish, we could take $n$ to some ridiculously large number (but not quite infinity) and create something that almost resembles a realistic filament. This would, however, come with computational costs. In my own research I’ve taken $n$ to be 100. We further assume the rod is inextensible and elastic; each segment has fixed length and the rod returns to a straight configuration when force is removed. Each segment is also described by two spherical polar angles so we know which direction in 3D space it is pointing in, like this:

For a bundle of $m$ filaments, we therefore have $2mn$ of these angles, describing the shape of the bundle.

Why is this discrete assumption valid?

DNA is a discrete chain of amino acids so it’s logical to model DNA by a discrete curve. The discrete approximation shows good convergence to the continuous case.

The force is strong with this… bundle

Under extreme forcing a filament will deform, and the most common ways this can be done is via bending or twisting (pictured below). For us to describe this mathematically we turn to our good friends in differential geometry.

Filaments deform either by bending or twisting

Curvature and twist tell us how a continuous curve is bending and twisting—but our discrete curve is made of straight lines! For this reason, we need discrete analogues. One way to describe curvature is to draw a circle that is the best possible fit at a point on a continuous curve—like the one here:

We then define the curvature $\kappa$ as $\kappa = r^{-1}$. Essentially, curvature is telling us the best ‘circular approximation’ of the curve locally. Again, our problem lies within the fact that our rod is made of straight edges! Not to worry, though; we can still define discrete curvature at vertices and use a `circle of best fit’ to achieve our goal:

Defining twist is a little harder as discrete curves do not have nice properties of continuity and differentiability. What we can do is assign a separate frame of reference, called a material frame, to each segment of the curve. Discrete twist $\gamma_j$ is then the difference in angular rotation of material frames between neighbouring segments. It can be thought of as a `rate of rotation’ of the material frame about its tangent vector. Here’s a diagram:

Energy minimisation

Nature is lazy, in that it will always choose the path of least resistance. If you have ever tried to bend or twist a tube you will have noticed that it resists this motion—this is because it is energetically costly for the tube to be bent or twisted. For this reason we are motivated to factor in energy minimisation to model our bundle.

The way it works is that we first assign a so-called energy function to the bundle, which takes different values depending on the bundle shape, and then minimise this function using calculus techniques. We construct this energy function as a sum of energy `penalties’. Each penalty corresponds to a physical behaviour that is energetically costly, ie bend and twist.

The penalty will be larger the more a bundle exhibits such behaviour, since the actions of bending and twisting the tubes add stress and strain. We should add a further penalty to represent applied loads, and an interaction penalty to prevent unrealistic self-intersection of filaments, so our energy function is $$E = E_{\text{bend}} + E_{\text{twist}} + E_{\text{load}} + E_{\text{interaction}}.$$ A minimum of the energy function, $E$, will be a balance of these energy terms. For example, a straight rod with applied force has higher loading energy and smaller bending energy than a bent rod.

For the remainder of this article, though, we will focus on bending and twisting: these are elastic actions.

“I am your father”

One of the greatest cinematic twists of all time! Although not quite the twist we are talking about here. Let’s take a closer look at constructing the elastic energy penalties.

What form should the bending penalty take?

There are two properties we desire the penalty to have:

  1. Material resistance: we want to control how stiff a filament is.
  2. Sensitivity to curvature: extreme bending of filaments is unrealistic and we want to heavily penalise this.

Bundles in the body are embedded in tissue or surrounded by fluid, and unless something goes very wrong they won’t bend beyond $\pi/2$. It is up to us to ‘tell’ the model that filaments shouldn’t bend this far in sensible parameter regimes. Suppose we define the angle between rods as $\alpha$, like this:

Then one way to stop the filament bending too far is by making the penalty very large when $\alpha\leq\pi/2$. Let’s introduce a bending coefficient $B$ to directly control the resistance of a rod to deformation. We choose a quadratic energy term, $B\kappa^2$, so that the bending energy grows sufficiently fast to penalise extreme deformation:

Sensitivity to bending can be controlled by the bending coefficient $B$, for example, here I make it 10 times larger:

Discrete curvature is defined at each interior vertex. Summing over all interior vertices gives the bending penalty for the rod. In other words, the bend energy depends on the curvature $\kappa$, $$E_{\text{bend}} = B\sum_{j=1}^{n-1} \kappa_j^2,$$ and importantly, we can directly evaluate $\kappa$ from the spherical angles we introduced earlier.

Cantina bend

When we use functions to approximate the behaviours of certain quantities, it isn’t always easy trying to find the right function based on the restrictions at hand.

In our case, $E_{\text{bend}}$ is a quantity that should grow quickly when curvature is non-zero. We could have tried an exponential function, but for a straight rod $E_{\text{bend}}=0$, so that’s no use. The next best thing would be to use a polynomial, and a quadratic is a relatively simple choice that works. We wouldn’t want to overcomplicate it!

The twist penalty is constructed using a similar argument. We are always looking for minima of the energy functions. A technique widely used in mathematical modelling to do this is via Lagrange multipliers, but we won’t go into detail here. The important point to note is that the twisting energy will automatically be minimised when each segment has a uniform twist, $\gamma$. This simplifies the penalty as we now need just one variable to calculate the penalty, rather than knowledge of a set of $\gamma_j$s, $$E_{\text{twist}} = t_c \sum_{j=1}^n \gamma_j^2 = t_c n \gamma^2,$$ for a twist coefficient $t_c$.

Although we have constructed this twist penalty with safe arguments, it is unclear how we can evaluate it, since unlike $\kappa$, we don’t have a direct way of calculating $\gamma$. We are keeping track of the shapes of the filaments, but two filaments can have the same shape, but a different amount of twist.

Enter a new hero to this tale—the Călugăreanu theorem! This says that the bending (or writhe as Călugăreanu labels it) and twist of a curve always sum to a constant for any given filament. As the filament deforms, this constant remains the same. Mathematically, we can say $$\mathcal{T} + \mathcal{W} = \mathcal{L},$$ where $\mathcal{T} = n \gamma/2 \pi$ is the total twist of a filament, $\mathcal{W}$ is the polar writhe, and the constant $\mathcal{L}$ is called the net winding. To evaluate the twist energy $E_{\text{twist}}$ it is sufficient to rearrange the above equation for $\gamma$: we prescribe $\mathcal{L}$, so we just need to calculate the writhe!

A Jedi’s guide to net winding

Here we are merely scratching the surface of some deep topological relations between curve behaviours. ‘Net winding’, $\mathcal{L}$, is an invariant of a curve, and remains constant as a curve deforms. It can be thought of as the number of turns in a straight filament. We can control this value of net winding in simulations. Importantly, net winding changes the elastic behaviour of a curve.

The tubes here have the same writhe (shape) but different amounts of twist. This is a result of each tube having a different associated net winding.

Spot the difference! Image: Naina Praveen/Chris Prior.

However, before we hit the hyperdrive to celebrate our victory, the enemy have a secret weapon.

The writhe integral is terrifying!

For tangent $\boldsymbol{T}$ and position $\boldsymbol{x}$ at arclength $s$,$$\mathcal{W} = \frac{1}{4\pi} \iint \boldsymbol{T}(s) \times \boldsymbol{T}(s^\prime) \cdot \frac{\boldsymbol{x}(s)-\boldsymbol{x}(s^\prime)}{|\boldsymbol{x}(s)-\boldsymbol{x}(s^\prime)|^3} \,\mathrm{d}s\,\mathrm{d}s^\prime.$$ Unfortunately for us, a discrete approximation of this integral isn’t friendly, either. We need a computationally tractable method to calculate the writhe. The secret trick is to exploit the geometric relationship writhe has with spherical surface areas.

The special relationship we are talking about is a tantrix: a continuous set of tangents along a curve that map out a continuous curve on the sphere of radius 1.

How to construct a tantrix: If you look at the purple knot on the left, you’ll see we’ve drawn a green tangent at a point. We can draw that tangent vector so its tip is on the unit sphere, as in the central image. If we trace the tip of this arrow as we go round the purple knot, we get the tantrix, the yellow curve, on the right. Image: Naina Praveen/Chris Prior.

In the case of a discrete rod, we have a defined set of $n$ tangents, which are then each mapped to a point on the sphere, joining points by shortest paths as we go. With these few adjustments to account for the fact our curve is open and discrete, we can use a relation between the writhe and surface area bounded by the tantrix of a discrete curve, $$\mathcal{W} = \frac{\mathcal{A}}{2 \pi}.$$ With this, we can then evaluate and minimise the energy function. Thankfully, much of the minimisation process can be handled by a computer—at each stage of minimisation, the computer calculates gradients of the energy function and uses these to ‘update’ the parameter set.

The computer runs until the gradients are approximately zero (ie when we have reached a minimum). The details of gradient calculations are quite tedious, but the important thing is we need to be able to calculate $\gamma$. We therefore have our full recipe:

  1. Find the tantrix for our filament and calculate the spherical surface area $\mathcal{A}$ that it bounds.
  2. Calculate the total twist using $$\mathcal{T} = \mathcal{L}-\frac{\mathcal{A}}{2\pi}.$$
  3. Determine the twist, $$\gamma = \frac{2\pi\mathcal{T}}{n}.$$
  4. Evaluate the energy gradients to minimise.

Simulations of a hexagonal bundle using different values of net winding: from top to bottom, $\mathcal{L} = 0$, $1.5$ and $2.5$. The bundle is more twisted for higher winding values.

The mathematician strikes back

Kirchhoff rod theory, developed by German physicist Gustav Kirchhoff, models continuous slender bodies. What we have actually done so far is define a discrete approximation of the energy functional used in the continuous case. The discrete approach has the advantage of being very flexible. New, often more realistic, complications can easily be added to the model by adding new penalties to the energy function and minimising as before.

One of the more simple first attempts at adding complications is to connect the ends of filaments in the model by Hookean springs: those where the exerted force is proportional to its displacement from equilibrium. A Hookean energy term penalises stretching and compression of the springs, representing the high energetic cost of stretching the bacterial membrane, and is a relevant energy penalty to include due to the observation that filaments attach the DNA origami to a somewhat `stretchy’ bacterial membrane. If we imagine a setup like this:

then the new energy term is $$E_{\text{membrane}} = \sum_{j=1}^{m-1} k \left(\mathit{\Delta}_j-\mathit{\Delta}_0 \right)^2.$$ Here, $\mathit{\Delta}_0$ is the equidistant distance between endpoints at rest, $\mathit{\Delta}_j$ is the distance between endpoints $\boldsymbol{p}_j$ and $\boldsymbol{p}_{j+1}$, and $k$ is the spring constant. Energy is proportional to the square of extension in accordance with Hooke’s law.

By including further energy penalties we can build up a more complex and realistic model. Mathematical modelling opens the door to exploring complex behaviours of objects in our physical and biological world, complementing experimental efforts. DNA origami is our Jedi master in the fight against antibiotic resistance!

post

Gearing up for the track

The governing body, World Athletics, allows several slightly different shapes for a 400-metre track. The simplest lay-out consists of two semi-circles joined by straight lines. The radius of the semi-circles, measured to the inside edge of the track, is 36.5m. The straights are 84.39m long. We can easily check that these curves add up to a length of 400m, by computing \[ 2 \cdot \pi \cdot 36.5 + 2 \cdot 84.39 = 398.116\ldots \] Hang on… This is no mistake! The official distance is measured 30cm away from the inside edge of the track. If we take this into account, the radius of the semicircles increases to 36.8m, and we find \[ 2 \cdot \pi \cdot 36.8 + 2 \cdot 84.39 = 400.001\ldots \] Close enough, I suppose… I’ll just round everything to two decimal places from now on. Still, this means that if a runner manages to stay close to the inside edge, they may be able to complete a lap in less than 400m!

Continue reading

post

How many tiles does this game have?

Sometimes I find an old game and it makes me notice or wonder something mathematical. For example, I found Rubik’s Tangle 2 in a charity shop.

In his memoir, Rubik describes a period after the initial cube craze died down where he worked on other puzzles, including this one. My copy of Tangle 2 is dated 1990, placing it within the second wave of the Rubik’s cube. On the box he explains that he hopes to “create things that challenge the mind—which everyone can play and enjoy”.

Tangle is a tile-based puzzle where the aim is to arrange the tiles into a square so that the ropes form continuous lines. You can see some example tiles in the header image.

At first I thought it would be quite complicated to work out how many tiles you could make like this. There are eight points around the edge of the square tile, two per edge, where four-coloured ropes enter and leave the tiles.

After a little examination, though, I realised the same asymmetric design is on all cards, and every card uses each colour once. This is a much simpler counting problem! There are four options for the colour of the first rope, then three for the second, two for the third, and the remaining colour goes to the fourth. There are $4!=4 \times 3 \times 2 \times 1 = 24$ possible tiles. The game comes with 25 tiles so you can make a square. Since we have 24 different patterns and 25 tiles, it follows that there must be more than one tile for at least one of the patterns (a concept called the pigeonhole principle).

In fact, all of the 24 different patterns are included and exactly one is duplicated; the duplicate tiles are these:

Rubik tangle tiles

Continue reading

post

On the cover: Folding hydrogels, encoding mathematics

In February of 2025, Tom Montenegro-Johnson, professor of applied maths at the University of Warwick, approached us with a proposal—to spend three full days collaborating with paper artist Coco Sato on her next piece. Tom and Coco have worked together for years, developing inspiring pieces motivated by the fluid dynamics that Tom uses in his cutting-edge research, including an evocative public engagement piece for the University of Birmingham which saw hundreds of students create origami butterflies. Now, we had to leave our algebra in the office and spend some time reflecting on how our research could be made into artwork. Even more dauntingly, we then had to make it happen. Fortunately for us, origami and fluid mechanics are more closely related than one might expect at first glance.

Taking shape

Origami, the art of folding paper to form complex geometric structures, has been practised in Japan for centuries, with references to paper cranes and origami butterflies dating as far back as the 17th century. Interest in origami was originally purely for recreational and decorative purposes, but over the years origami structures grew in complexity and nowadays, people are looking to origami not only as a fun creative outlet but for new innovations in science and engineering.

Techniques from origami can be used to build shape-transforming structures. An example is the folding mirrors used in the design of the James Webb Space Telescope: these mirrors can fold into compact formations suitable for rocket travel, and unfold after launch into the convex or concave shapes required for distant infrared light collection. A video of the telescope unfolding is available on YouTube, and on Nasa’s website there are even instructions to create your own James Webb origami. The same ideas can be used to create medical devices, such as a stent (a device used to hold open a vessel in the body which has lost structural stability). Origami engineering has allowed new stents to be built which can be delivered with minimal invasion in their compact ‘folded’ state, and then unfold only once perfectly in place.

Our research group specialises in the mathematical modelling of hydrogels: these are soft, hydrophilic gels made from networks of polymers which can swell to many times their original volume through absorption of water. Some day-to-day hydrogels you may have encountered include soft contact lenses, blister plasters, and the children’s toy Orbeez. Hydrogels are useful for a wide variety of medical applications because their ability to hold large amounts of water makes them highly biocompatible (meaning that they have similar material properties to human tissue).

Orbeez

Orbeez are made of hydrogel

They are also useful as actuators, because they can be designed to respond to changes in their environment, and hence exert forces and torques on nearby objects. For example, a hydrogel could be programmed to swell in response to increased temperature, which could then trigger the folding or unfolding of a larger structure. Hydrogels which respond to their environment in this way are called smart hydrogels. Below are two classic designs for hydrogel actuators:

In the first example, known as a bilayer, the upper hydrogel layer expands, causing its length to increase, which then forces bending in the lower layer. The second example, the box hinge, has a similar mechanism, but produces a sharper fold. With these ideas, hydrogels could be used as a trigger to fold and unfold an origami-inspired device.

These are very simple actuator designs, but by programming hydrogels to respond to external stimuli precisely in a desired way, they can be used to build soft robots, and even ‘hydrogel brains’—a recent study designed a hydrogel which could play Pong!

We brought together these ideas of origami engineering, and programmable, smart hydrogels to create the artwork you now see on the cover of your copy of Chalkdust.

Creating origami

We were inspired by some of Coco’s previous works with modularity for this piece. In particular, we loved the almost algorithmic nature of some of her tessellating pieces, where lots of smaller origami structures come together to display a bigger picture—much like how it takes many pixels to create an image on a screen.

The individual units that we need to fold for this piece are called ‘Sonobe units’. Though the origin of the name is unknown it is shared with a town in Kyoto, Japan. These units are commonly used in mathematical modular origami as they are relatively beginner friendly to build, and when combined in 6, 12 or 30 units can make a cube, octahedron or icosahedron respectively. See ‘How to make a Sonobe unit’ in the magazine to make your own!

These units are then combined together in a repeating pattern as laid out in the below photo of Coco’s previous artwork.

Sonobe units

Sonobe units. Image: cocosato.co.uk

In our case, we wanted to showcase our research on responsive hydrogels, so we pieced our Sonobe units together to make a picture of a swelling hydrogel tube, inspired by recent work by Tom and our colleague Joe Webber:

A simulation of a responsive hydrogel pump from a recent paper by Joe Webber and Tom Montenegro-Johnson, which inspired our origami art.

Heating the tube at the left end causes the gel to start shrinking and expel fluid, creating a pump mechanism. The swelling of the gel is governed by the advection–diffusion equation

\begin{equation*} \partial_t \phi + \boldsymbol{q} \cdot \boldsymbol\nabla \phi = \boldsymbol\nabla\cdot[D(\phi)\boldsymbol\nabla \phi]. \end{equation*} Here, $\phi$ is the porosity of the gel—at each point in the gel, the value of $\phi$ conveys what fraction of the gel is water and what fraction is solid matrix. A porosity of 1 therefore corresponds to pure water, while zero corresponds to completely dry. The vector $\boldsymbol{q}$ represents the overall velocity of material, accounting for both the water and solid matrix, and $D(\phi)$ is a diffusion coefficient determined by the chemical properties of the gel.

Encoding equations

We wanted to link our hidden message back to the exciting prospect of ‘soft computers’ by ‘programming’ a secret message into our origami. There are many ways to hide a message. The entire field of cryptography was generated for such a purpose. We decided to find a way to convert the governing equation for hydrogel swelling into a binary string. It becomes relatively simple to convert between different number systems, but our equation has more symbols than numbers within it so we needed to translate first into a number system.

Given that mathematicians will use an encoding language to type up maths equations onto a typesetter, we chose to begin from the LaTeX of the equation:

\partial_t \phi + q \cdot \nabla \phi = \nabla \cdot [D(\phi)\nabla \phi]

We need to convert this to a string of ones and zeros, but first converting it into a string of any numbers will do. Luckily in 1963 an IBM engineer faced a similar challenge, and the American Standard Code for Information Interchange (Ascii) was devised as a character encoder. Ascii assigns a unique numerical code, ranging from 0 to 127 to each upper case letter, lower case letter, digit and symbol. Converting this text string of LaTeX code will then give us a series of 66 numbers—one step closer to our goal!

Finally, we convert the string of numbers into its binary representation. When we write numbers in decimal, each new digit represents how many (between 0 and 9) of that power of 10 we have, so right to left we have units, tens, hundreds, thousands, etc. In binary we do something similar. So the first entry is twos, then fours, then eights, then sixteens, and so on. If we want to do the conversion by hand, an easy method is to continually divide the number by two, at each step document the remainder (either 1 or 0), and then read the number backwards. For example:

\begin{alignat*}{2} 53/2&=26 &\text{ remainder }1,\\ 26/2&=13 &\text{ remainder }0,\\ 13/2 &= 6 &\text{ remainder }1,\\ 6/2 &= 3 &\text{ remainder }0,\\ 3/2 &= 1 &\text{ remainder }1,\\ 1/2 &= 0 &\text{ remainder }1. \end{alignat*}

So, 53 becomes 110101.

We want to encode each of the numbers to have the same number of digits, so we’re going to commit a little bit of bad maths and stick some zeros at the start of the numbers so each number is the same length in binary. Our biggest possible number is 127 (the largest Ascii value) which is 01111111, as 128 is the 8th power of 2. With this we made every number in our array 8 bits long. This means for our string of 66 numbers, we would have $66\times8 = 528$ ones and zeros to encode in our artwork in order to capture the full equation. In the final piece, lighter colours represent zeros and darker colours represent ones.

Put it together and what have you got?

We had three days to bring this work to life, and after day one the six of us (four postdocs, Tom and Coco) were only able to fold approximately 300 modules, it became quickly apparent that reinforcements needed to be called in. Luckily the PhD students at the University of Warwick delivered; with many hands on deck we were able to complete folding all of the individual units by the middle of day three (after a quick break for an incredible guest seminar by Emma Bouckley, University of Cambridge, as part of the soft matter seminar series). Then we were back at it to combine the units together and attach it to the boards.

Overall there was something incredibly satisfying about combining maths and art, and Coco was a fantastic guide into the world of paper artistry. We were able to bring to life a new method of data visualisation, and enjoy all the messiness and chaos that came with it. As mathematicians, many of us felt like creating art was not for us, but this work made us see that art can take many forms, and that we all have unique perspectives to contribute. Perhaps we are more artistic than we think.

The final piece, by Coco Sato, Tom Montenegro-Johnson, Daniel Booth,
Emma Bouckley, Ellen Jolley, Kat Phillips, Joe Webber and volunteers from the University of Warwick.

post

Let’s build a prime detector!

Primes—they were my introduction to the mysticism of mathematics, and I’ve had a soft spot for them ever since. My only problem with them is how elusive they are—whenever I discover a cool new number, I’ve always got to go out of my way to check whether it is prime or not… Wouldn’t it be better if there were some function which just told us if a number is a prime?

Well, of course it would! And to construct such a function, we could always take the easy route by simply defining a function $p$ such that
\begin{align*} p(x) \equiv \begin{cases} \;1 &\text{ if $x$ is prime,} \\ \;0 &\text{ if $x$ is not prime.} \end{cases} \end{align*}

This $p(x)$ unequivocally succeeds in being a prime detector, but it is rather… boring. While nothing is stopping us from taking this $p(x)$ and running off into the sunset with it, I am assuming that you, as a reader of Chalkdust, would be a tad more interested in a more captivating (and fun) mathematical story about prime detectors.

Our aim today is therefore to build a prime detector from the ground up using some pretty simple mathematics. Specifically, the detector we will be constructing is one which I built myself back in high school. Yes, built.

Continue reading

post

Significant figures: Julia Robinson

It is no secret that throughout the history of mathematics women have been hidden. As someone with a passion for gender equality and a supporter of initiatives to promote women and underrepresented genders in mathematics, I was surprised to be made aware of a woman who was key to one of the results I had mentioned briefly in a talk (I also regarded this as Matiyasevich’s result in a previous Chalkdust article). Of course, mathematics is a hierarchical subject with new results building upon previous results, usually by different people. While this is good for the progress of the field, it does mean that in many cases the people whose results are a fundamental step are not as recognised as the final step. A key result to the resolution of Hilbert’s tenth problem was made by Julia Robinson, and this is her story.

Early life

Julia Hall Bowman Robinson was born in Missouri, United States on 8 December 1919. When Julia was two, her mother passed away. Her father, a business owner, remarried and raised their children, including Julia, an older sister, Constance Reid, and a younger sister, Billie Comstock. Her biological mother’s passing was not the only major event in Julia’s childhood, as when she was nine she suffered a number of serious illnesses leading to her being out of school for two years, and this is when her attraction to mathematics began.

Julia Robinson was born in St Louis, Missouri. Jefferson National Expansion Memorial, NPS, CC BY 2.0.

Julia’s results

Initially, Julia studied mathematics at university with the intention of being a high-school teacher. Instead, she continued her studies and was awarded a PhD, titled Definability and decision problems in arithmetic at the University of California, Berkeley. Her PhD supervisor was Alfred Tarski, a logician—she was one of his first students! Julia’s work in mathematics was predominantly on decidability, in the context of logic: this is determining whether an algorithm exists to solve a problem in a finite amount of time. One such problem she looked at was Hilbert’s tenth problem: to decide whether an algorithm exists to determine whether a given Diophantine equation has any integer solutions.

Fun fact:

Julia and her husband both enjoyed puzzles and even introduced Dana Scott to pentominoes, which you can read more about in this article.

Julia’s hypothesis

A Diophantine equation can be written as $P(x_1,\dots,x_n)=m$ where $m$ is a parameter and $x_1,\dots,x_n$ are variables. A Diophantine set, we will call it $S$, is then a subset of integers $m$ for which there exist integers $x_1,\dots,x_n$ such that $P(x_1,\dots,x_n)=m$. For example, the set of natural numbers given by

$\{x \in \mathbb{N} : x = a^2+2b^2, a,b \in \mathbb{Z} \}  = \{1,2,3,4,6,9,\dots\}$

is a Diophantine set. Martin Davis and Hilary Putnam also worked on Hilbert’s tenth problem but from a different direction to Julia. They approached it from a number theory perspective, whereas she approached it as a logician. Julia took a hiatus to pursue politics, during which Davis and Putnam posed a result dependent on two hypotheses. Julia returned to mathematics and removed one of these, but the other remained and Davis and Putnam coined it the JR hypothesis.

University of California, Berkeley. Jefferson National Expansion Memorial, NPS, CC BY 2.0.

The implication of Julia’s result was that, if it were possible to construct a Diophantine set which grows exponentially, this would imply the undecidability of exponential Diophantine equations which would then imply the undecidability of Diophantine equations. To conclude, to show that no such algorithm could exist, it would be necessary to find a Diophantine set that grows exponentially, and this was what Yuri Matiyasevich did!

Being a woman

While studying for her PhD, women were not permitted in the main dining room of the faculty. This meant that Julia could not participate in many mathematical conversations. Fortunately, her husband, Raphael Robinson, was present in these conversations and reported back things he thought she would find interesting, one of which being Hilbert’s tenth problem. While Julia made many mathematical accomplishments, including a plethora of awards such as the MacArthur fellowship and giving the Noether lecture, being a woman in maths came with its own challenges. Despite both being mathematicians in their own right, Julia was not able to get a job in the same department as her husband and although she wanted to teach calculus, ended up working in the statistics department. It took over three years of her husband being retired for her to be made a full-time professor in the mathematics department.

Impact on mathematics

Julia was the first woman elected president of the American Mathematical Society and the first woman mathematician elected to the National Academy of Sciences, but she didn’t want to be remembered just as the first woman to do this. As a mathematician, she wanted to be remembered for the theorems she proved. As well as a big impact towards the final solution of Hilbert’s tenth problem, she also solved one of the Rand Corporation’s prize problems in game theory, but due to being an employee of the company, she never received the prize fund.

Final words

In 1984, Julia Robinson was diagnosed with leukaemia and she died shortly after. Growing up, she was inspired by reading stories about other mathematicians and her sister Constance Reid convinced her to let her write Julia’s biography in the short time before she died.

Constance Reid (1918–2010)

Constance was a writer and, while not considering herself as a mathematician, won a number of awards for mathematical exposition. She wrote a number of biographies of mathematicians, including Julia’s.

post

A tale of $n$ cities

The famous Dickens novel highlights the political and social chaos amid the French Revolution, taking place primarily in London and Paris. Sending messages between these two cities was obviously of extreme importance. In fact, the story is set in motion by a cryptic message received from France—but I will leave that analysis to the GCSE students. Our interest lies with these messengers.

We begin with a messenger who flags down a mail coach to deliver an important communication to one of the passengers and waits to receive their reply. The issue is that the mail coach naturally has other passengers, not to mention a driver and security guard, who will hear everything and, of course, gossip about it afterwards.

So what if they wanted a means of secure communication? If a pair of pen pals in different cities wanted to exchange private messages, and they were too paranoid to trust a public mail service, they might want to extend their circle of trust the minimum amount, ie by one more person—an exclusive letter carrier used only by that pair of people and no one else.

In our mathematical version of the tale, we will tell the story of how many ways there are of matching up pen pals in various cities. As we will see, this count is made easier by matching each pen pal pair to an exclusive letter carrier they can trust. With this count in hand, we can also estimate the typical number of letter carriers servicing any pair of cities.

Following Dickens, we open with the book where $n=2$.

Retelling a classic

We would like to assign, to each and every person in these two cities, a unique pen pal from the other city. How many ways are there of pairing up the people of city 1 with those of city 2?

The first obvious point is that the two cities must have the same population, say, $k_1$. Then there are $k_1!$ ways of assigning pen pals under the usual explanation that ‘citizen 1’ of city 1 has $k_1$ choices for their pen pal, then ‘citizen 2’ has $k_1-1$ choices, etc. But there is another way to arrive at the same count which involves the secure messengers that we introduced earlier. If we also include $k_1$ exclusive letter carriers, enough for each pen pal pair, now how many ways are there of assigning them?

Each pen pal pair has one unique letter carrier

Let us first match the people of city 1 to the letter carriers. Citizen 1 of city 1 has $k_1$ choices of letter carrier, citizen 2 has $k_1-1$ choices, etc. So there are $k_1!$ ways of joining the $k_1$ citizens of city 1 with the $k_1$ letter carriers. Citizen 1 of city 2 also has $k_1$ different letter carriers to choose from (and each one has a person of city 1 connected to them). Citizen 2 of city 2 has $k_1-1$ choices, etc. This brings about another factor of $k_1!$, so we have $k_1!k_1!$ different arrangements.

We could also think about this as ‘pen pal pair 1’ having a choice of $k_1$ letter carriers, then ‘pen pal pair 2’ having a choice of the remaining $k_1-1$ letter carriers, etc. Since we know from our previous argument that there are $k_1!$ different ways to match pals, then the extra $k_1!$ has come from deciding which pair gets which letter carrier.

A drawback in this process is that all of the letter carriers are running the same route. This ruins efficiency, not to mention the travel costs for the secure messaging company, and so we introduce the rule that if two letter carriers are going between the same city, they might as well be the same person. From a security perspective, things might actually be safer, as there will be nobody else for the letter carrier to share information with.

Because of this, the extra factor of $k_1!$ which counted the permutations of the letter carriers amongst the pairs needs to be divided out: $k_1!k_1!/k_1! = k_1!$, and we are back to the original count of the number of ways of pairing the citizens of cities 1 and 2.

Why would we introduce the different carriers and count the ways of distributing them amongst the pairs just to undo it again?

A tale of three cities

We’re now going to investigate how the pen pal problem changes when we consider three cities, which should hopefully resolve the cliffhanger ending of the previous book. Let’s have the populations be $k_1$, $k_2$ and $k_3$ for cities 1, 2, and 3, respectively. We no longer need the constraint that the populations be equal, but instead we must have:

  1. the combined population of the three cities be even,
  2. $k_1 + k_2 \geq k_3$,

assuming without loss of generality that $k_1 \leq k_2 \leq k_3$. The combined population must be even because every pen pal pair consists of two unique people. The second condition stems from the fact that if the total population in the two smallest cities is too small to provide a match for each person in the largest city, then there will be people left over in the largest city, and since we don’t have pen pals in the same city, we reach a contradiction. In the special case that $k_1+k_2=k_3$ there will be no pen pals between cities 1 and 2.

In general, let there be $p_1$ pen pal pairs between cities 1 and 2, $p_2$ between cities 2 and 3, and $p_3$ between cities 1 and 3, as pictured below.

A triangle diagram, showing unevenly-sized connections between the three cities k_1, k_2 and k_3.

Doncaster, Wolverhampton and Peterborough

Then it must be that
$$\begin{split} &p_1 + p_3 = k_1,\\ &p_1 + p_2 = k_2,\\ &p_2+p_3=k_3. \end{split} $$
If we take $k_1$, $k_2$, and $k_3$ to be known populations, then we have a linear system of three equations in three unknowns: $p_1$, $p_2$, and $p_3$.

This is, therefore, a solvable system with a unique solution for each $p_i$, namely:
$$\begin{split} &p_1 = \tfrac{1}{2}\left(k_1+k_2-k_3\right),\\ &p_2 = \tfrac{1}{2}\left(k_2+k_3-k_1\right),\\ &p_3 = \tfrac{1}{2}\left(k_3+k_1-k_2\right). \end{split} $$
With our setup now demanding letter carriers for each route, we introduce $p_1$ of them to be assigned to each of the pen pals between cities 1 and 2. Each one is unique and delivers letters between two distinct people. In total, the $p_1$ letter carries serve $k_1 + k_2 – k_3$ people: all of those in the combined populations of cities 1 and 2, less those who are pen pals with someone in city 3. Since each letter carrier works for two people, $(k_1 + k_2 – k_3)/2$ counts the number of carriers who work between cities 1 and 2.

The argument generalises for the expressions for $p_2$ and $p_3$. The notion of the letter carriers will hopefully now not seem so ridiculous; in our last book, the number of letter carriers would have been $p_1 \equiv k_1$. Now, each $p_i$ is of a more complicated form, and so dividing through by the $p_i$ will be nontrivial.

With this in mind, how many ways are there (assuming it is possible at all) to match up the citizens in the three cities with pen pals from a different city?

The same diagram as before, but the solid sections connecting each city are now depicted as several individual lines, labelled 1 through p_1 (or p_2 or p_3).

Each pen pal pair has a unique letter carrier between them.

There are $k_1!$ ways of joining the citizens of city 1 with the $p_1+p_3=k_1$ letter carriers which service city 1; $k_2!$ ways of matching up the $k_2$ citizens with the $p_1+p_2=k_2$ letter carriers which service city 2; $k_3!$ ways of matching up the $k_3$ citizens of city 3 with the $p_2+p_3=k_3$ letter carriers which service city 3. In total we have $k_1!\,k_2!\,k_3!$ ways of assigning citizens to pen pals via unique letter carriers.

One should note that $p_1$ of the $k_2$ letter carriers servicing city 2 have already been assigned a citizen of city 1, and in a similar fashion $p_2$ of the $k_3$ letter carriers servicing city 3 have already been assigned a citizen of city 2 The remaining $p_3$ have been assigned a citizen of city 1.

As before, we now say that a letter carrier is distinguished only by their route, ie the two cities they service, and not by the particular pen pal pair they deliver letters for. So we need to divide by the number of ways $p_1$ pen pal pairs can be assigned to $p_1$ letter carriers, by $p_1!$. We need to do the same for $p_2$ and $p_3$. This provides us with
\begin{equation*} \frac{k_1!\,k_2!\,k_3!}{\left(\dfrac{k_1+k_2-k_3}{2}\right)!\left(\dfrac{k_2+k_3-k_1}{2}\right)!\left(\dfrac{k_3+k_1-k_2}{2}\right)!} \end{equation*} different ways of pairing the citizens with their pen pals, based on the solution for the $p_i$ above.

Let’s try some concrete numbers to get a sense of things. We start with some unnaturally small populations: $\{k_1,k_2,k_3\} = \{3,4,5\}$. This gives $\{p_1,p_2,p_3\} = \{1,3,2\}$, and the number of matchings is $1440$. A slightly larger example is $\{k_1,k_2,k_3\} = \{6,8,12\}$, yielding $\{p_1,p_2,p_3\} = \{1,7,5\}$, however the number of matchings is now nearly $23$ billion.

Notice that the $p_i$ are directly proportional to the population sizes—we could just as easily consider the $k_i$s above to be counted in millions, then the $p_i$s would be also. But the number of matchings would increase much, much quicker and would be of the order of ten to the power of millions!

A tale of four cities

With each next book in a series, the readers are promised more lore and unexpected twists and turns that give the characters a more interesting backstory. In the tale of four cities we do exactly that and introduce entropy.

First, we set up our populations $k_1$, $k_2$, $k_3$, $k_4$ and will again assume $k_1\leq k_2\leq k_3\leq k_4$. We must require that the total population, $k_1+k_2+k_3+k_4$, be even. We will also require that $k_1+k_2+k_3 \geq k_4$, else, as before, there will be unmatched citizens in the largest city. There are now six groups of letter carriers connecting the cities, as pictured below.

A diagram with four "cities", arranged in a square and labelled k_1, k_2, k_3, k_4, with "edges" of different widths between each pair.

The six routes in the tale of four cities and their respective counts of pen pal pairs

On the left, a diagram with cities [1,4] and [2,3] joined; on the right, two possible swaps: [1,2] and [3,4], or [1,3] and [2,4]

Two kinds of swap—a given pen pal pair between cities 1 and 4, and another between cities 2 and 3, can be reconfigured in two different ways

This makes it easy to build a linear system of equations that connect the $p_i$s with the $k_i$s:
$$ \begin{split} &p_1 + p_2 + p_3 = k_1\\ &p_1 + p_4 + p_5= k_2\\ &p_2 + p_4 + p_6=k_3\\ &p_3 + p_5 + p_6=k_4. \end{split} $$
If we take the populations to be fixed, these are four equations for six unknowns—the system is undetermined. Unlike the previous tales, here the numbers $p_i$ are not fixed by the populations $k_i$. Why not?

Consider, for example, the two sets of letter carriers $p_3$ and $p_4$ that work between cities 1 and 4, and cities 2 and 3, respectively. Let’s imagine these two carriers are friends and during their regular deliveries, they decide to meet up somewhere central to chat. What would happen if they left the meeting with the other carrier’s bag by accident?

Well, clearly the concerned pen pals are going to receive messages intended for someone else, but the accident also reveals something interesting about the tale of four cities. Notice that there are two ways this accident could play out, depending on which directions they were heading when they met.

In the first way, the two carriers are simulating the jobs of a $p_1$ carrier and a $p_6$ carrier. In mathematical terms, $p_{3,4} \to p_{3,4} – 1$ and $p_{1,6} \to p_{1,6} + 1$. In the second way, they would be simulating the jobs of a $p_2$ carrier and a $p_5$ carrier, so $p_{3,4} \to p_{3,4} – 1$ and $p_{2,5} \to p_{2,5} + 1$.

In either of these scenarios we see that, without changing the populations of the four cities, there is a freedom in how we choose the values of the $p_i$. In fact, given that there are two ways to swap, this freedom is two-dimensional. This is consistent with having four equations to fix six unknowns; there will be a two-parameter family of solutions to this linear system.

Here’s that fourth-book twist: different ways of matching up citizens with pen pals can result in different numbers of carriers servicing the links between cities! This gave me an exciting, new question to ask: given fixed populations $k_i$, how many carriers should we expect to need to assign to each of the six links between cities on average? That is, assuming all possible ways of matching citizens to pen pals are equally likely to occur, what are the typical values of the $p_i$?

I should first clarify that these ‘typical values’ really only make sense when the cities’ populations are large. In fact, the larger they are, the more likely it is that the $p_i$ are found to be at these typical values; put another way, the more rare it is to find them deviating from these values.

The answer to our question turns out to be that the typical values for the $p_i$ obey the relations
\begin{equation*} p_3p_4=p_1p_6=p_2p_5. \end{equation*} Let’s gain some intuition for why this should be true before going into the mathematical details. Imagine the two kinds of ‘swap’ shown previously in pink were happening randomly at some average rate. There are $p_3p_4$ ways to choose one of the $p_3$ letter carriers (that serve cities 1 and 4) and one of the $p_4$ (that serve cities 2 and 3) to be the ones involved in a swap. In the first kind of swap, we could restore the values of the pre-swapped $p_i$ by randomly choosing a carrier counted amongst the $p_1$ and another counted amongst the $p_6$ (there are $p_1p_6$ ways to do this) and have them ‘swap back’.

When a towel is dry, and you are wet, you can use it to dry yourself. But if the towel becomes too wet, it stops being effective, as it deposits as much water as it removes. This represents a state of maximal entropy. Random processes tend to increase entropy towards a maximal value.

Note that we aren’t quibbling about the fact that $p_1$ and $p_6$ have increased by 1 in the swap; the city’s populations are large meaning the $p_i$ are also large numbers—large being much, much greater than 1. The random process will naturally drive the system towards the state where the probability of swapping is equal to the probability of swapping back, ie when $p_3p_4=p_1p_6$. The same argument could also be applied to the second kind of swap, and the corresponding condition there is $p_3p_4=p_2p_5$.

This argument of the $p_i$s miraculously arranging themselves into a steady state has an intimate relationship with the concept of entropy. For those unfamiliar, I particularly like how Richard Feynman put it—see above. Indeed, we can draw our own analogy here between swapping, swapping back and the deposition or removal of water by the towel.

Maximising entropy

We can turn the $p_i$ into probabilities that a random letter carrier serves the corresponding route. Since each carrier serves two cities, $\sum p_i = 2 \sum k_i$, and this is a constant, fixed by the populations of the four cities. Let $N=\sum k_i$ be the total population across the four cities, then the probability that a random letter carrier is on route $i$ is $p_i/(2N)$. The entropy of a probability distribution is proportional to $-\sum p \ln p$ (more on this later), where $p$ are the probabilities, so for our distribution we have that the entropy is proportional to:
$$ \begin{split} -\sum_{i=1}^6 \frac{p_i}{2N} \ln \frac{p_i}{2N} &= -\frac{1}{2N} \sum_{i=1}^6 \big( p_i \ln p_i – p_i \ln (2N) \big)\\ &=-\frac{1}{2N} \sum_{i=1}^6 p_i \ln p_i + \ln (2N). \end{split} $$
As it turns out, neither the constant factor of $1/(2N)$ nor the additive constant $\ln(2N)$ are important to the maximisation, so we will drop them and define our entropy to be $S$, where
\begin{equation*} S = -\sum_{i=1}^6 p_i \ln p_i. \end{equation*}
Let’s look at the solution to the linear system of six unknowns. We saw that the system was undetermined; we will choose $p_5$ and $p_6$ to be our two independent variables without loss of generality and relabel them $x$ and $y$, respectively. Here’s the solution:
$$ \begin{split} &p_1 = \tfrac{1}{2} (k_1+k_2-k_3-k_4+2 y),\\ &p_2= \tfrac{1}{2}(k_1-k_2+k_3-k_4+2 x),\\ &p_3= k_4-x-y,\\ &p_4= \tfrac{1}{2} (-k_1+k_2+k_3+k_4-2 x-2 y),\\ &p_5=x,\\ &p_6=y. \end{split} $$
To gain some familiarity, let’s look at a specific example. We will take populations of $k_1 = 300$, $k_2=5000$, $k_3=18000$ and $k_4=22000$. In order to satisfy the constraint that none of the $p_i$ are negative, we must have $(x,y)\geq (4350,17350)$, but also have that $x+y \leq 22000$. This leaves some wiggle room for possible values of $x$ and $y$ since $22000-4350-17350=300$. We can allocate all, or a part of the 300 to $x$ and $y$ as we like, to increase them from their minimum values. The most likely configuration turns out to be when $35$ is added to $x$ and $9$ is added to $y$. This gives $p_1 = 9$, $p_2=35$, $p_3 = 256$, $p_4=606$, $p_5=4385$, $p_6 = 17359$.

The number of possible matchings here is very large, and would be measured by numbers near 10 to the power of a hundred thousand. What would happen if we considered a solution not too far away from optimal? For example, if we set $x=p_5=4400$ and $y=p_6=17365$, then we find $p_1=15$, $p_2=50$, $p_3=235$, $p_4=585$. The number of matchings is still astronomically large, but is some 400 times smaller than the optimal value.

Returning to the entropy $S$, we can now view it as a function of $x$ and $y$, since the $p_i$ now depend on them. We therefore seek to find the values of $x$ and $y$ which maximise
$$ S(x,y) = – \sum_{i=1}^6 p_i(x,y) \ln p_i(x,y). $$
The maximum occurs where the derivatives of $S$ with respect to both $x$ and $y$ are zero. Further, the fact that $\sum p_i = 2 N$ is a constant means its derivatives with respect to both $x$ and $y$ are zero also. In essence, we can differentiate our definition of entropy $S$ and be left with
\begin{equation*} \begin{split} &\frac{\partial}{\partial x} S(x,y) = -\sum_{i=1}^6 \left[ \frac{\partial}{\partial x} p_i(x,y)\right] \ln p_i(x,y),\\ &\frac{\partial}{\partial y} S(x,y) = -\sum_{i=1}^6 \left[ \frac{\partial}{\partial y} p_i(x,y)\right] \ln p_i(x,y). \end{split} \end{equation*}
This ultimately results in
$$ \begin{split} &\frac{\partial}{\partial x} S(x,y) = -\ln p_2 + \ln p_3 + \ln p_4 – \ln p_5,\\ &\frac{\partial}{\partial y} S(x,y) = -\ln p_1 + \ln p_3 + \ln p_4 – \ln p_6 , \end{split} $$
and setting these quantities to zero means that $p_2p_5 = p_3 p_4 = p_1p_6$, as we argued before.

Why $\sum p\ln p$?

Now, I wonder how many of you thought ”wait, where does $-\sum p \ln p$ come from?”. Rather than answer that question, let me give you a way to see why finding values of $x$ and $y$ which maximise $S(x,y)$ is the same as asking for the values of $x$ and $y$ which maximise the number of ways of matching citizens with pen pals. Following our earlier theme, the number ${\cal N}$ of matches is
\begin{equation*} {\cal N} = \frac{k_1!k_2!k_3!k_4!}{p_1!p_2!p_3!p_4!p_5!p_6!}. \end{equation*}
Taking a logarithm, we find
\begin{equation*} \ln {\cal N} = \sum_{j=1}^4 \ln (k_j!) – \sum_{i=1}^6 \ln (p_i!) . \end{equation*} There is a nice way to approximate the logarithm of a large factorial called Stirling’s approximation, $\ln(n!) \approx n\ln n – n,$ an approximation that is increasingly good the larger $n$ is. Using this approximation on $\ln {\cal N}$, we find
\begin{equation*} \ln {\cal N} \approx \sum_{j=1}^4 \ln (k_j!) + \sum_{i=1}^6 p_i -\sum_{i=1}^6 p_i\ln p_i. \end{equation*} The first two sums are both constants which don’t depend on $x$ or $y$. We see that, up to an irrelevant additive constant, $\ln {\cal N}$ is the entropy $S$. But since the logarithm is a so-called monotonically increasing function—a function whose graph always goes up—finding the values of $x$ and $y$ which maximise $\ln {\cal N}$ is the same as finding the values which maximise ${\cal N}$ itself.

A touch of irony

We can now work out what the values of $x$ and $y$ are in order to write down the typical values of the $p_i$. Our entropy-maximising constraints are $p_2p_5=p_3p_4$ and $p_1p_6=p_3p_4$, and in terms of $x$ and $y$ these are:
\begin{equation*} \begin{split} x (&k_1-k_2+k_3-k_4+2 x)\\ &=(-k_1+k_2+k_3+k_4-2 x-2 y)(k_4-x-y),\\ y (&k_1+k_2-k_3-k_4+2 y)\\ &=(-k_1+k_2+k_3+k_4-2 x-2 y) (k_4-x-y) . \end{split} \end{equation*} These equations define two intersecting hyperbolas in the $x$-$y$ plane. In order to find the relevant point of intersection in terms of the $k_i$, we can solve the second equation for $y$:
\begin{equation*} y=\frac{(-k_1+k_2+k_3+k_4-2 x) (k_4-x)}{2 (k_2+k_4-2 x)}, \end{equation*} and then substitute this into the first equation. What results from this substitution is a fourth-order polynomial, also called a quartic, in $x$:
\begin{equation*} a x^4 + b x^3 + c x^2 + d x + e = 0, \end{equation*}
where
$$ \begin{aligned} a&=12, \\
b&=8 (k_1 – 2 k_2 + k_3 – 2 k_4),\\ c&= k_1^2 + 7 k_2^2 – 8 k_2 k_3 + k_3^2 + 10 k_2 k_4 – 8 k_3 k_4\\ &\qquad \qquad + 7 k_4^2 – 2 k_1 (4 k_2 + k_3 + 4 k_4),\\ d&=-(k_2 + k_4) \big(k_1^2 + k_2^2 + (k_3 – k_4)^2\\ &\qquad \qquad – 2 k_2 (k_3 + k_4) – 2 k_1 (k_2 + k_3 + k_4)\big),\\ e&=k_2 k_4 (k_1 + k_2 – k_3 + k_4) (k_1 – k_2 – k_3 – k_4). \end{aligned} $$
Famously, the quartic is the highest degree polynomial for which one can write down a solution in terms of basic arithmetical operations $+,-,\times,\div,\surd$. There is no such formula for polynomials of degree $\geq 5$. This is ironic—the tale of four cities is the first time we have a problem to solve, since we had no freedom to alter the $p_i$ in the tale of three cities. It is also the last case where a solution can be ‘written down’—it is a horribly long expression, which would fill an entire page, and I will spare you from having to read it. We can, however, visualise the typical values (see below).

A diagram like the previous one, this time without labels or colours, emphasising how the widths of different "edges" are different. The circles with the most total edge width are the biggest.

Circle radii are proportional to the city’s population; route widths are proportional to the number of pen pals.

A touch of agony

We end our story by considering the tale of $n\geqslant5$ cities, where we begin with some counting. The big question is how many routes are there for $n$ cities? Well, every route serves exactly two cities, so there are ${n\choose 2} = n(n-1)/2$ routes. The linear system will provide $n$ equations and will hence fix $n$ of the $p_i$ (let these be $p_1,p_2,\ldots ,p_n$) in terms of the remaining \[\frac{n(n-1)}{2} – n = \frac{n(n-3)}{2}\] others. So we will have $n(n-3)/2$ variables which will need to be fixed by an equal number of entropy-maximising constraints. To understand where the constraints come from, we will build up our distribution network starting with the first $n$ routes. We are free to choose how these join the $n$ cities—see the picture below.

n cities, joined by n routes: the first n-1 connect City 1 to each of the others, and the nth connects City 2 to City 3.

The first $n$ routes

The remaining routes come in two varieties. First, there are $2(n-3)$ routes which connect each city $j\geq 4$ with cities two and three. For each of these we have a ‘tale of four cities’ scenario which fixes the associated variables, $x$ and $y$. Then, there are $(n-3)(n-4)/2$ routes which connect cities $j$ and $\ell$, where $j,\ell\geq 4$.

The two routes $x$ and $y$ connect city 6 with cities 2 and 3: in total there are $2(n-3)$ routes connecting cities 4 to $n$ to cities 2 and 3. Together, routes $x,y, p_1, p_2, p_5$ and $p_n$ form a tale of four cities.

Route $z$ connects cities 5 and 6: in total there are $(n-3)(n-4)/2$ routes connecting cities $j$ and $\ell$, where $j, \ell \geq 4$.

To fix these variables we introduce a new flavour of swap. We decrease $z$ by $1$, increasing both $p_4$ and $p_5$ by $1$, and also decrease $p_1$ and $p_2$ by $1$, increasing $p_n$ by one. The associated entropy-maximising constraint is $zp_1p_2=p_4p_5p_n$.

Let’s take a tally of these constraints. We have $2(n-3)$ relations of degree two which must involve the product of two $p$s, and $(n-3)(n-4)/2$ relations of degree three. If we were to try to reduce this system of $n(n-3)/2$ equations, by using the various equations to eliminate variables until there was one final polynomial to solve, it would have a degree equal to
\begin{equation*} d_n=2^{2(n-3)}\times 3^{(n-3)(n-4)/2}. \end{equation*} The sequence begins $d_4 = 4$, $d_5 = 48$, $d_6 = 1728$, $d_7 = 186624$, $d_8 = 60466176$.

A polynomial of degree sixty million? Well, that’s the touch of agony.

Donovan is a teacher and former physicist who can’t stop seeing mathematics in just about everything he looks at.

post

Don’t connect four

Every month, people from all over the world meet up locally for MathsJam, where we share cool puzzles, games and problems. There is also an annual gathering of all of us maths enthusiasts, and at last year’s event this was one of the many puzzle competitions:

Place the most points on the vertices of a triangular lattice such that all points are connected, but no more than three points are allowed to be collinear.

For example:

The blue and green dots are not connected so this is not allowed.

The four orange dots are collinear so this is not allowed.

This is allowed

Polyominoes

Alternatively, the puzzle could have been framed to say:

Make a single pattern of tiled hexagons where no more than three tile centres are allowed to be collinear.

The same example images could look like this:

The blue and green hexagons are not connected so this is not allowed.

The centres of the four orange hexagons are collinear so this is not allowed

This is allowed

Patterns of connected tiles such as these are called polyominoes, and the tiles themselves are called cells. The examples on the previous page use a hexagon as the cell type, and the hexagonal polyominoes produced are sometimes called polyhexes. Other shapes can be used as the cell type, and it’s most likely that you will come across square polyominoes. The unqualified term polyomino is often used on its own to assume square cells.

Just like polygons, we name the subsets based on their size, so a domino is a polyomino of two cells, a triomino has three cells, and then there are the familiar tetrominoes used in the game of Tetris.

Keeping in the context of the square, the next size, of five cells, are the pentominoes. There are 12 of them, and there is also a nice puzzle here: Can you fit them all inside a rectangle, say $6\times10$, without them overlapping each other?

The five tetrominoes (if reflections are treated as the same)

The 12 petrominoes

As we increase the number of cells, the number of possible shapes grows exponentially, and it is not easy to count how many there are of a given size. We also have to be clear about what we are counting. If we rotate or reflect the pattern and it looks different, should we count it as a genuine new instance or ignore it as a duplication because of symmetry? The terms free and fixed have been adopted to make this distinction. Here’s an example of a free pentomino:

And here are the eight fixed symmetrical versions of it:

So when counting free polyominoes, we ignore the symmetrically equivalent ones as duplicates. People interested in counting the number of each size have got up to working out that there are 2,150,182,610,161,041,739,167,164,220 free polynomials that can be made with 50 squares and 18,500,792,645,885,711,270,652,890,811,942,343,400,814 fixed polynomials that can be made with 70 squares.

These huge numbers are sourced from the On-Line Encyclopedia of Integer Sequences (OEIS), which is a great resource I recommend checking out if it’s new to you (see sequences A000105 for free and A001168 for fixed).

Polyomino collinearity

So far, we have seen two attributes of a polyomino, the type (cell shape) and the size (number of cells). Inspired by the opening puzzle, I decided to explore cellular collinearity. If we say that a subset of cells within a given polyomino are collinear if their centres are on the same line, then I define the collinearity of the polyomino to be the size of the largest possible subset. In other words, the maximum number of cells that are collinear. I’ve not come across any standard way of notating polyomino meta data, so the following notation to describe this breakdown more algebraically is purely something I’ve made up for this context. \begin{align*} P(n) &= \text{set of all polyominoes with $n$ cells},\\ P(n,k) &= \text{set of all polyominoes with $n$ cells}\\[-0.8mm]&\hspace{4.2mm}\text{and a collinearity of $k$}. \end{align*}

So $P(n)$ is made from the union of disjoint sets $P(n,k)$: \begin{align*} P(n) = P(n,1)\cup P(n,2)\cup \cdots \cup P(n,k). \end{align*} The cardinality of a set is the number of members it contains. So, for example, in the diagram below the cardinality of $P(4)$ is $|P(4)|=5$ because there are five free polyominoes that have four cells (the Tetris shapes).

Breaking up the sets by collinearity

Computer search

As mentioned earlier, the counting of free polyominoes is not a simple task for several reasons:

  • the nature of how they evolve,
  • the possibility of symmetric duplicates,
  • being completely sure none have been missed out.

I love writing code to investigate maths stuff and this exploration had a lot of great challenges. Deciding how to model the polyominoes, handle the symmetry (especially the hexagon), determine the collinearity, visualise the results, ensure a complete search and all running in an optimal time meant there was a rich stew of consideration to stir during my idle thoughts over that autumn.

Finding every member of $P(n,k)$: adding a cell increase $n$ by 1, and either increases $k$ by 1 or leaves it unchanged.

To be sure that I was counting all possibilities, I took the iterative approach of getting a result for $P(n)$ by using what I had already found for $P(n-1)$. For example, starting with the tetrominoes, for each one, add a new cell at every possible new location to get all the possible pentominoes.

We can further refine this method for collinearity, on the basis that adding a new cell can only ever increase the collinearity by one, or leave it unchanged. So in order to find $P(n,k)$, we only need to consider polyominoes in $P(n-1,k-1)$ and $P(n-1,k)$ as the starting point for adding a new cell.

Flowchart of the algorithm

If adding this new cell does not give a polyomino with the collinearity we require, then we discard and try another new cell. But if it does, then we need to be sure that we are not double counting a previously found shape that is a symmetric or translated equivalent of it. To stop that happening, there is a normalisation step which orients newly discovered polyominoes in a consistent fashion to make it easy to tell if any two shapes are the same. In other words, if a set of fixed polyominoes are all actually the same shape, just symmetrically different, then normalisation will orient them all to the same shape, so then comparing them for being the same becomes an easy task.

To the right, there is a flowchart explaining how the algorithm works.

If you want to look at the Python code, it’s at github.com/daveisagit/collinear-polyominoes. The results of the searches are available on the OEIS: A377942 is the sequence for square cells, and A378015 is the sequence for hexagonal cells. The first ten rows of A377942 are shown below.

The first ten rows of A377942: $|P(n,k)|$ for square cells

 

Square polyominoes

Before heading back to the motivation for looking at collinearity (the puzzle), which was to find the largest hexagonal polyomino with a collinearity of 3, let us look at the square as it is a simpler case. You’ll see from the example data in A377942 and just looking at the vertical sequence where $k=3$ that it starts to descend when $n=10$, $P(10,3)=78$ as highlighted. In other words, there comes a point when the polyominoes become so large that finding ones with collinearity $k \leq 3$ gets harder, and there are fewer of them as we increase the size.
It turns out that for $k \leq 3$ the sequence is finite (A378169), having just 15 terms and the last term being 1 means that there’s only one largest square polyomino with a collinearity of 3. It looks like this:

It seems unnecessary now to separate the lower values of $k$ since they are mostly zeros, and so let’s just consider the cumulative amount for $k$, or in other words, where the collinearity of the polyomino $\leq k$. Extending our notation to express this cumulative amount as

\begin{align*} C(n,k) = P(n,1) \cup P(n,2) \cup \cdots \cup P(n,k). \end{align*}

The number of polyominoes with collinearity of 3 or less ($T_n$) as the number of cells ($n$) increases resembles a bell curve

That is, $C(n,k)$ is the set of all polyominoes with $n$ cells, and a collinearity $\leq k$. We can then make a sequence using $T_{n}=|C(n,3)|$ where $T_{n}$ is the $n$th term of it (using $T_n$ to notate the $n$th term of a sequence is a typical notation). Charting the values of $T_n$ forms something close to a bell curve: 1, 1, 2, 4, 9, 18, 37, 62, 86, 78, 61, 34, 14, 4, 1.

The largest square polyomino with a collinearity of 3 being made by the algorithm.

Playomino

Screenshot of playomino.pages.dev

I like a good (and preferably simple) proof and so wanted to prove that there would be an upper bound for $n$ based on the maximum allowed collinearity $k$. Internet searches return a few papers that may fit the bill, but I cannot easily digest and regurgitate them into something palatable. So instead of putting effort into trying to concoct some hard to follow proof, I spent the time developing a little web app that allows you to explore things for yourself. I invite you to visit playomino.pages.dev to get a feel for how collinearity becomes a restrictive attribute in creating both square and hexagon polyominoes.

Trying to use thin steps still runs into the collinearity restriction

It seems that whatever you do, after a while, you run out of space. Staying in a local area hits a limit, and if you try to escape to another local area, then the path you take to get there becomes a problem too.

OK, so what about increasing the collinearity limit to $k\leq 4$? I soon discovered that it would take a long time to compute using my current approach and code, but in the spirit of adventure I thought it was worth the risk of burning out my laptop processor. Three months later, after analysing 150 million polyominoes, I had a result! It turns out to be a polyomino of size 48, but I am deliberately holding back on what it looks like for now, as I don’t want to create spoilers for what might be a future competition somewhere. There are \num{135629410647775553284438364} polyominoes of size 48, but only one of them has no more than four collinear cells!

Again, it gives a similar bell curve weighted to the right but with a significant leap in the number of polyominoes found (A380990).

Number of polyominoes with a collinearity of 4 or less

So we now have the beginnings of another new sequence, the largest number of cells of a polyomino with at most $n$ collinear cell centres. (A380991) It starts $1,4,15,48,\dots$ but will we ever know what comes next? In terms of where to next, I think it would be amazing if someone could come up with a formula for a good upper bound (let alone a least upper bound) for a given collinearity $k$ and I would love to know if this collinearity attribute of polyominoes has any relevant application outside of puzzle land.

Thank you

Before wrapping up, I want to emphasise that this whole journey down this rabbit hole has been epic! I am sure without the MathsJam community, Chalkdust and OEIS, I would still be maths-curious, but without them it would certainly not be as joyous. Thank you all. Special thanks to Declan O’Donnell for coming up with his elegant competition entry, `Dots on a tiling’: without it, none of this would have happened. I also apologies to him, too, for giving away (close the magazine now, to avoid reading) the answer.

Hexagonal polyominoes

So, we come full circle back to the puzzle. What is the largest hexagonal polyomino with a collinearity of 3? Like the square, the sequence (A377756) is finite and forms a sort of bell curve. But unlike the square, there are two different, but similar looking answers for the largest size.

The answer is 23!

For me personally, their twin-like nature and constellation-like appearance have a lot of character, and I named them Elliott and Isaac.

Twenty years ago, we lost our newborn twins a couple of days after their birth. Despite all the water under the bridge since then, I still think of them, and usually when noticing something in an abstract way, like a couple of butterflies dancing on the breeze or a pair of polyominoes presented on a page. Thank you Chalkdust for allowing me to remember them in this way.

Elliott

Isaac