It was a problem that had baffled mathematicians for centuries — until British professor Andrew Wiles set his mind to it.

“There are no whole number solutions to the equation xn + yn = zn when n is greater than 2.”

Otherwise known as “Fermat’s Last Theorem,” this equation was first posed by French mathematician Pierre de Fermat in 1637, and had stumped the world’s brightest minds for more than 300 years.

In the 1990s, Oxford professor Andrew Wiles finally solved the problem, and this week was awarded the hugely prestigious 2016 Abel Prize — including a $700,000 windfall.

Learning of the award, Wiles told the University of Oxford: “It is a tremendous honor … Fermat’s equation was my passion from an early age, and solving it gave me an overwhelming sense of fulfillment.

“It has always been my hope that my solution of this age-old problem would inspire many young people to take up mathematics and to work on the many challenges of this beautiful and fascinating subject.”

The prize, often described as the Nobel of mathematics, was awarded by the Norwegian Academy of Science and Letters, with an official ceremony featuring Crown Prince Haakon of Norway to take place in May.

“Wiles is one of very few mathematicians — if not the only one — whose proof of a theorem has made international headline news,” said the Abel Committee.

“In 1994 he cracked Fermat’s Last Theorem, which at the time was the most famous, and long-running, unsolved problem in the subject’s history.”

Wiles, 62, first became fascinated with the theorem as a 10-year-old growing up in Cambridge, England, after finding a copy of Fermat’s Last Theorem at his local library.

“I knew from that moment that I would never let it go,” he said. “I had to solve it.”

He spent seven years intensively working on the equation in secret while at Princeton University, finally cracking it in 1994 by combining the three complex mathematical fields of modular forms, elliptic curves, and Galois representations.

“I was very lucky that not only did I solve the problem, but I opened the door for a whole new era in my field,” said Wiles.

“Problems that had previously seemed inaccessible, now became open.”

“You never forget the moment you have these great breakthroughs — it’s what you live for,” he added.