As a student at Harvard in the 1970s, Bill Gates impressed more than one faculty member with his mathematical brilliance.

He proposed an elegant solution to what’s known as “pancake sorting,” and his insights were published in the journal Discrete Mathematics in 1979, in a paper co-bylined with then Harvard professor Christos Papadimitriou.

A few years ago, Papadimitriou, now a professor of computer science at the University of California, Berkeley, shared an anecdote about working with Gates in a publication of the Association for Computing Machinery. The anecdote resurfaced in a recent answer on the Quora thread, “How intelligent is Bill Gates?“

The story serves as a reminder that the wealthiest and most successful people among us may have been exceptional from the start.

Here’s Papadimitriou:

When I was an assistant professor at Harvard, Bill was a junior. My girlfriend back then said that I had told her: “There’s this undergrad at school who is the smartest person I’ve ever met.”

That semester, Gates was fascinated with a maths problem called pancake sorting: How can you sort a list of numbers, say 3-4-2-1-5, by flipping prefixes of the list? You can flip the first two numbers to get 4-3-2-1-5, and the first four to finish it off: 1-2-3-4-5. Just two flips. But for a list of n numbers, nobody knew how to do it with fewer than 2n flips. Bill came to me with an idea for doing it with only 1.67n flips. We proved his algorithm correct, and we proved a lower bound — it cannot be done faster than 1.06n flips. We held the record in pancake sorting for decades. It was a silly problem back then, but it became important, because human chromosomes mutate this way.

Two years later, I called to tell him our paper had been accepted to a fine maths journal. He sounded eminently disinterested. He had moved to Albuquerque, New Mexico to run a small company writing code for microprocessors, of all things. I remember thinking: “Such a brilliant kid. What a waste.”

Thirty years later, other researchers found a sorting strategy that’s 1% faster. But according to an NPR interview with Harry Lewis, another Harvard professor who taught Gates in the 1970s, those researchers had the help of powerful computers. The young Gates, on the other hand, relied solely on his own cognitive resources (and in fact he helped develop the computers that would find a faster solution).