Where do ideas come from? That’s a big question. Here’s a smaller one: Where do mathematical ideas come from? I’ve wondered about this from the time I first contemplated being a mathematician until long after I officially became one.

My earliest memory of anything like a mathematical idea comes from a childhood walk with my dad. We left the house and made our way toward downtown Metuchen, the tiny town in central Jersey where I grew up, to a little luncheonette called the Corner Confectionery. I can still picture it: the rack of newspapers, magazines, and comic books; the ice-cream treats in the back corner; the long counter with stools, where I used to sit and spin until I was told to stop. It was about a mile-long walk, reserved for special occasions. On that bright fall morning, we strolled up Spring Street—a beautiful street lined with huge oak trees—and talked about fractions, though I wouldn’t have known to call them that. We were puzzling over—or, rather, I was puzzling over—how to fairly divide a pie (probably one of the Corner Confectionery’s apple pies). My dad, a mathematical physicist, a man with an active mind, but one of few words, was a gentle guide, letting me think through things on my own.

We took our time walking, and we also took our time thinking and talking about the basic properties of numbers. In my head, it was easy to cut the pie in half, and then in half again, and again: two, four, or eight pieces. But, somewhere near Main Street, I got stuck on how to reliably create three, five, or six pieces. I started thinking about making bigger numbers out of smaller numbers. This leisurely walk through the neighborhood soon led me to the exciting idea that twelve was a great number. Twelve could be divided by one, two, three, four, and six. That’s a lot of numbers! If I had a pie cut into twelve pieces, it would be easy to divvy up dessert for many different-sized groups of friends. By the time we crossed the railroad tracks and arrived at the door of the Confectionery, I thought that I had made a remarkable discovery: Everyone! Stop! We need to think about the world in terms of twelves!

Ten or so years later, when I was a college freshman, I would learn that I had stumbled upon an instance of what is called an abundant number, a phenomenon first studied by the ancient Greeks. An abundant number is smaller than the sum of its divisors: in my case, the sum of one, two, three, four, and six (twelve’s divisors) is sixteen. That morning with my dad, I didn’t have a name for this phenomenon, but I was happy nonetheless, and maybe even happier because I was ignorant of the larger picture. It was my own surprising little discovery, born of walking and puzzling. Magic all around.

As odd as it might sound, I’ve never been particularly confident of my mathematical abilities. I don’t mean the arithmetic part, the part that people usually associate with being a mathematician. (“Hey, let Dan calculate the tip! Ha ha!”) It’s true that I’m probably better than average at mental math, but that’s not really what makes a mathematician a mathematician. My job is to come up with ideas. Sometimes we mathematicians call the things we think about and work with “objects,” which doesn’t mean triangles, spheres, or other shapes. Mathematical objects are big ideas about algebra, geometry, and logic, about the properties and definitions of numbers.

It’s not at all obvious how to go about thinking up some new twist on these things—the transformation from test-taker to theorem poser and then theorem prover is difficult to articulate. My ideas have always felt contingent and magical to me. I don’t think I’m alone, at least as far as the magic goes. Henri Poincaré, the father of chaos theory and the co-discoverer of special relativity, is famous for a story that appears in his 1908 book “Science and Method,” about an insight being jarred loose while boarding a bus: “At the moment when I put my foot on the step, the idea came to me, without anything in my former thoughts seeming to have paved the way for it.” The Irish mathematician Sir William Rowan Hamilton, who devoted many years to searching for a way to multiply numbers in higher dimensions, had a similar epiphany, in 1843, just as he was strolling by the Brougham Bridge, in Dublin, while on a walk with his wife. He was so delighted that he stopped and carved the defining algebraic equation into the bridge: i2=j2=k2=ijk=-1. One person’s graffiti is another person’s breakthrough.

These stories suggest that an initial period of concentration—conscious, directed attention—needs to be followed by some amount of unconscious processing. Mathematicians will often speak of the first phase of this process as “worrying” about a problem or idea. It’s a good word, because it evokes anxiety and upset while also conjuring an image of productivity: a dog worrying a bone, chewing at it to get to the marrow—the rich, meaty part of the problem that will lead to its solution. In this view of creative momentum, the key to solving a problem is to take a break from worrying, to move the problem to the back burner, to let the unwatched pot boil.

All problem solvers and problem inventors have had the experience of thinking, and then overthinking, themselves into a dead end. The question we’ve all encountered—and, inevitably, will encounter again—is how to get things moving and keep them moving. That is, how to get unstuck.

For me, the quest for a breakthrough often requires getting myself into literal motion; one small step for Poincaré but a whole sequence of steps for me. I’ll take a long hike, during which my mind has nothing to worry about except putting one foot in front of the other, or I’ll go for a long drive, so that my primary focus is on the road. Maybe it’s the endorphins, or maybe it’s refocussing my attention on some other activity which enables a new idea. Perhaps it is the momentary feeling of being untethered that gives the mind free rein—the space to have a good idea.

In college, I was about twenty hours into a twenty-four-hour take-home algebra exam when I became convinced that I’d hit a permanent block. I went to the weight room, where, bench-pressing in the midst of noisy midday regulars, I finally figured out the key to proving the irreducibility of a certain group of symmetries (in the case of the exam question, all the symmetries of a soccer ball). It happened again a few years later, in Somerville, Massachusetts, when I was in the final stages of my Ph.D. During a regular workout at Mike’s Gym, a friendly, bare-bones place tucked back by the railroad tracks, I experienced an epiphany that would inspire the final chapter of my dissertation. My power-lifting and body-building buddies got a shout-out in the acknowledgements.

Perhaps the most memorable instance was a breakthrough jog I took in Hanover, when I was a young professor at Dartmouth. My colleagues and I were trying—and mostly failing—to come up with an efficient method for solving a class of equations that describe all kinds of waves: both the familiar ones we find in the shallows of oceans and the cosmic ones generated by the Big Bang. We spent every day drawing on blackboards and chasing one wrong idea after another. After one afternoon spinning our wheels, I decided to take advantage of a beautiful day and threw on my running clothes. I had a regular route, which I varied by running it in reverse every other time. That day, I headed away from campus, on a tree-lined and leaf-filled ramble. As I crested the last hill, I saw it all at once: the key to modifying the algorithm we’d been puzzling over was to flip it around, to run it backward. My heart started racing as I pictured the computational elements strung out in the new, opposite order. I sprinted straight home to find a pencil and paper so that I could confirm it. I’m pretty sure I didn’t shower.