Learn

Start from nothing. By the end of this page you will be able to look at a row of letters and see a structure that most people walk straight past.

A word of four letters, shown in two halves. The first half is a, b. The second half is b, a.

The pattern

Read that as one word of four letters, cut down the middle. The left half is a b. The right half is b a.

The two halves are not the same word — the letters come in a different order. But each half holds one a and one b. Nothing was added and nothing was taken away; the order was simply shuffled.

That is the whole phenomenon. A block, followed by a rearrangement of the same block.

Order and quantity are different things

We are used to comparing words letter by letter. By that test ab and ba are plainly different.

But there is a second, coarser way to compare them: ignore the order entirely and just count. How many as? How many bs? By that test the two halves are identical.

First half — a b

a ×1 b ×1

Second half — b a

a ×1 b ×1

When two adjacent blocks of equal length match on that second test — same counts, any order — the pair is called an abelian square.

It costs nothing to check and it is easy to miss. Longer blocks work the same way:

A word of six letters in two halves. The first half is a, b, c. The second half is b, c, a. Each half contains one a, one b and one c.

Spot one yourself

Three short words. In each one, is there a place where some block is immediately followed by a rearrangement of itself?

1. a b c a b

Show the answer

No. This word contains no abelian square at all.

No letter is repeated back to back, so there is nothing at block length 1. At block length 2 there are only two places to look: ab | ca and bc | ab. Neither pair holds the same letters. The word is too short for anything longer.

Ruling a word out is the same skill as spotting one: you check every block length, at every position.

2. a b b a

Show the answer

Yes. Split it in the middle: ab then ba. One a and one b on each side, in a different order. That is an abelian square — the same one you saw at the top of this page.

There is a second one hiding inside it: the single letters b and b sit next to each other, and a block of one letter followed by the same letter also matches on counts.

3. a b c b a c

Show the answer

Yes, but only at block length 3. Split the word in half: abc | bac. One of each letter on both sides.

Nothing shorter works here — no repeated letter, and none of the length-2 pairs match. Long blocks are exactly where these stop being visible, which is why avoiding them by eye gets hard fast.

The explorer has a tool for this, with any word you like and the matching blocks marked for you as you type.

Try it with your own words

What it means to avoid them

Now turn the question around. Instead of finding abelian squares, try to write a word that contains none at all — no block anywhere, of any length, immediately followed by a rearrangement of itself.

Start writing and you will feel the difficulty quickly. Every letter you add creates new adjacent pairs of blocks, at every length, all of which must avoid matching. The constraint tightens as the word grows, and a word that looks fine can turn out to have been doomed several letters earlier.

So the interesting question is not whether you can avoid them for a while. It is whether you can keep going — and that turns out to depend on how many different letters you are allowed to use.

How many letters do you need?

With three letters, you cannot keep going. The longest word over three letters containing no abelian square is 7 letters long, and there are exactly 18 of them. After that, every continuation fails.

With four letters, you can. Veikko Keränen showed in 1992 that an infinite abelian-square-free word exists over four letters, and gave a concrete rule that builds one: a substitution that replaces each letter with a specific 85-letter block, applied over and over.

That gap — impossible at three, possible at four — is what makes this a real subject rather than a puzzle. Change the rule slightly, and questions open up that nobody has answered yet.

Both statements above are recorded in this project's claim ledger with their sources: the three-letter bound as row 1, and Keränen's four-letter result as row 3, checked against the original 1992 paper.

Where next

  • Play

    The same mathematics as a puzzle. Break the repetitions you have just learned to see.

  • Explore the tools

    Search trees, morphisms and visualisations, in the browser.