Amir D. Aczel, a mathematician and author of many books about popular science, including “Fermat’s Last Theorem.” (Author Photo/Atria Books)

Amir D. Aczel, a mathematician who launched a second career as a best-selling author, most notably of “Fermat’s Last Theorem,” about how an enduring enigma of mathematics was ultimately solved, died Nov. 26 in Nimes, France. He was 65.

The cause was cancer, said his wife, Debra Gross Aczel.

Dr. Aczel (pronounced ahk-ZELL) spent years as a professor in Alaska and Massachusetts and wrote textbooks on math and statistics before discovering a talent for explaining the world of science and numbers to ordinary readers. He first gained widespread acclaim in 1996 with “Fermat’s Last Theorem: Unlocking the Secret of an Ancient Mathematical Problem.”

The problem had been one of the great unsolved mysteries of mathematics since about 1637, when a French jurist and amateur mathematician named Pierre de Fermat wrote an equation in the margin of a book, followed by the tantalizing words: “I have discovered a truly marvelous proof of this, which, however, the margin is not large enough to contain.”

Fermat’s Last Theorem, as it became known, became the most persistent and baffling puzzle in the history of mathematics. For centuries, mathematicians searched for the ever-elusive solution to this problem: x(n) + y(n) could never equal z(n) if “n” was greater than 2.

Amir D. Aczel, mathematician and author of “Fermat’s Last Theorem” and other books. (Debra Gross Aczel)

In his book, Dr. Aczel fashioned a page-turning thriller of intellectual ad­ven­ture that, in his words, “spans mathematical history from the dawn of civilization to our own time.” It wasn’t until the 1990s that Andrew Wiles, a British mathematician at Princeton University, finally unlocked the mystery.

Dr. Aczel’s 147-page book was “a captivating volume,” New York Times critic Richard Bernstein wrote, “rooted in the pleasure of pure knowledge.”

Although some mathematicians considered “Fermat’s Last Theorem” simplistic, it spent months on best-seller lists and made Dr. Aczel something of an all-purpose explicator of scientific and mathematical phenomena.

In more than a dozen subsequent books, he analyzed the contributions of Einstein, Descartes and other scientists and mathematicians and demonstrated how statistics applied to everyday life — and to life beyond earth. In “Probability 1” (1998), Dr. Aczel calculated that the possibility of intelligent beings living elsewhere in the universe was 100 percent.

His 2004 book “Chance” weighed the odds on “gambling, love, the stock market and just about everything,” according to its subtitle. Dr. Aczel concluded that most people have better luck finding a soul mate than winning in Las Vegas.

One of his more personal books, “The Riddle of the Compass” (2001), derived from Dr. Aczel’s boyhood memories of sailing throughout the Mediterranean with his father, who was the captain of a cruise ship.

For most people, the compass is a simple directional device, tool, but Dr. Aczel knew that someone — most likely in China — had to invent it and put it to use in sailing the high seas. With its needle forever pointing north, the compass was, in Dr. Aczel’s words, “the first technological invention to change the world since the wheel.”

Amir Dan Aczel was born Nov. 6, 1950 in Haifa, Israel. He learned to navigate a ship before he learned to drive and became interested in mathematics, he said, while sailing with his father among Mediterranean ports of call.

In Monte Carlo, he was drawn to the roulette table.

“I was fascinated by these colorful numbers — ornate signs that beckoned me by their mystery, and which as I matured I would understand to represent fundamental abstract concepts that rule our world,” he later wrote.

After serving in the Israeli army, he came to the United States to study mathematics at the University of California at Berkeley, where he received a bachelor’s degree in 1975 and a master’s degree in 1976. He received a doctorate, with an emphasis on statistics, from the University of Oregon in 1982.

Dr. Aczel taught at the University of Alaska’s Juneau campus from 1982 to 1988, when he joined the faculty of what is now Bentley University in Waltham, Mass. He moved to Boston University in 2006.

In 1989, he published a textbook, “Complete Business Statistics,” that went through several editions and was used in many college courses. Not long afterward, Dr. Aczel was audited by the Internal Revenue Service, which he used as the basis for his first foray into popular mathematics, “How to Beat the IRS at Its Own Game: Strategies to Avoid — and Survive and Audit,” in 1994.

After the success of “Fermat’s Last Theorem” two years later, Dr. Aczel published almost one book a year, although not all were well received by critics. His final book, “Finding Zero: A Mathematician’s Odyssey to Uncover the Origins of Numbers,” was published this year.

He moved to Uzes, France, shortly before his death and maintained a home in Brookline, Mass. Survivors include his wife of 31 years, Debra Gross Aczel of Uzes and Brookline; a daughter, Miriam Aczel of London and Uzes; and a stepdaughter, Stephanie Hoover of Chicago.

In “Why Science Does Not Disprove God” (2011) and in other writings, Dr. Aczel challenged the view of British scientist Richard Dawkins that a rational view of the world held no room for religious faith.

“The incredible fine-tuning of the universe presents the most powerful argument for the existence of an immanent creative entity we may well call God,” Dr. Aczel wrote in a 2014 essay in Time magazine.

“Science and religion are two sides of the same deep human impulse to understand the world, to know our place in it, and to marvel at the wonder of life and the infinite cosmos we are surrounded by. Let’s keep them that way, and not let one attempt to usurp the role of the other.”