As a 16-year-old, Douglas** **Hofstadter was enchanted by numbers. As he writes in an essay I read recently, he “intoxicatedly explored the endlessly rich world of integer sequences”. Doing so, he ran into all kinds of patterns.

What patterns? Well, before exploring his, consider some others for yourself. Take the multiples of 9, for example: 9, 18, 27, 36, 45…. As innumerable children learning multiplication tables have found, the first digit here increases by 1 and the second digit decreases by 1 at each step. Makes it easy to remember. Or the squares: 1, 4, 9, 16, 25, 36…. Check the gaps between them: 3, 5, 7, 9…. We have the odd numbers!

Perhaps these are trivial; certainly they are so well-known that they would excite only children learning numbers—not that that’s to be sneered at (I believe it’s to be celebrated). But there are others. In fact, there’s no end to the patterns you can discover in numbers. You might even stumble on one that nobody has seen before. That’s Hofstadter’s “endlessly rich world”.

All those years ago, Hofstadter considered two sequences—the squares, mentioned above, and the so-called triangular numbers—1, 3, 6, 10, 15…(the successive sums of 1+2 +3+4…). He wrote them down and asked: How many triangular numbers between successive squares?

Try it yourself. Between the first two squares (1 and 4) we have two triangulars, 1 and 3. Between the next two (4 and 9), there’s one triangular, 6. Between 9 and 16, there are two: 10 and 15. Jot down these counts of in-between triangulars to get the sequence Hofstadter found: 212112121211212….

The question would occur to a mathematician, and to you: Is there a pattern here? The sequence contains just 1s and 2s, but is there anything else? Hofstadter writes that it “hovered fascinatingly between regularity and irregularity [and this] tantalized me no end”—but had no obvious pattern. Then he tried grouping the 1s and 2s, rewriting the sequence thus: 21, 211, 21, 21, 211, 21, 211, 21, 21, 211, 21, 211, 21, 211…. Still nothing. No, wait—count 21s between successive pairs of 211s. We get 21211…wow, do we have something? Yes indeed! As Hofstadter wrote: “This is exactly the same sequence all over again!”

Think about what happened here. Hofstadter picked two seemingly unrelated sequences. He searched for a connection between them and found something intriguing—a sequence of 1s and 2s—but with no apparent pattern. Then he looked deeper, in some sense, into the sequence and bingo! Lurking there is, of all things, a copy of itself.

This may put in your mind recursion, where things are defined in terms of themselves. Or fractals, shapes in which smaller parts are identical to the whole. These beautiful, powerful ideas have led to all manner of mathematical discovery. In this case, what he found so thrilled Hofstadter that he dug steadily deeper and wider. Over several years, he made what he calls “a series of leapfrogging analogies that led me from one empirical discovery to another to another”.

They made him long to become a mathematician. But in graduate school, he found his courses impossibly abstract and eventually dropped out. A decade later, he began working towards a PhD in solid-state physics. Seeking to understand how electrons in crystals behave in magnetic fields—something that had baffled physicists for years—he found that two constraints (the regular structure of a crystal, and the magnetic field) were analogous, in an abstract way, to the sequences he had interlaced years before. To his amazement, many of the same recursive ideas from his days playing with number sequences applied here. This became the core of his research. The heart of his thesis was an elegantly-coloured graph relating electron energy levels to the magnetic field, clearly showing the recursive, fractal nature of the relationship.

Plus, to his everlasting delight, Hofstadter’s PhD in solid-state physics was really a PhD in that early infatuation he hoped to study, number theory. “A rabbit pulled out of a hat!” he wrote to me. Hofstadter called his diagram “Gplot”. Over time, it became very well-known indeed. Only, people began calling it, with reason if you see it, the “Hofstadter butterfly”.

Nearly 40 years later, a physicist at George Mason University, US, who grew up in Chembur, Indu Satija, decided to write a book—a bouquet to the butterfly. Through her career, working on different related problems, she was charmed by the magic of the butterfly, by how beauty grows from such simplicity. She sent Hofstadter a draft and he worked on it with her as a self-declared “bull in a china shop”. He contributed a prologue relating the butterfly story, from which I’ve drawn the material for this column. The book is called *Butterfly In The Quantum World* and is itself a tour de force, of thought-provoking ideas, connections, art and even poetry. Remembering both Satija’s poetry-loving father and the mathematician Bhaskara’s treatise *Lilavati*, there are poems from scientists in India and abroad and one co-authored by her and Hofstadter.

Next week’s American Physical Society meet has a special session titled “The Butterfly Plot Turns 40” (goo.gl/tfSwy0). Hofstadter and Satija will both speak. How I would love to be a butterfly on that particular wall—marvelling, as I listen, at what we build when we play with numbers.

*Thanks to Indu Satija and Douglas Hofstadter for their inputs. *

*Once a computer scientist, Dilip D’Souza now lives in Mumbai and writes for his dinners. A Matter Of Numbers explores the joy of mathematics, with occasional forays into other sciences.*

*Comments are welcome at dilip@livemint.com. Read Dilip’s *Mint *columns at* www.livemint.com/dilipdsouza