Following his death, a mathematical formula was found scrawled in the margin of his notes, "xn + yn = zn, where n is greater than 2," which Fermat said had no solution in whole numbers, but he also added a phrase, "remarkable proof."
According to Jean-Luc Picard, people had been trying to find the proof for 800 years, including himself, during his leisure time. Picard found it stimulating, and noted that it put things in perspective stating that "in our arrogance, we feel we are so advanced and yet we cannot unravel a simple knot tied by a part-time Frenchmathematician working alone without a computer." (TNG: "The Royale")
"The Royale" aired in 1989, six years before a proof for Fermat's last theorem was published by Andrew Wiles of Princeton University, using advanced 20th century mathematics. Fermat's original proof is still unknown, with many mathematicians suspecting that Fermat was mistaken in believing he had solved the problem. Although on face value it might seem that The Royale introduced a continuity error by not knowing the problem would be solved by the 24th century, Picard's statements is consistent with him being interested in trying to find the original proof. 
In the script of "Facets", Tobin starts trying to explain to Jadzia that "The thing you've got to remember when you're trying to normalize the equations is...", before interrupting himself. This dialogue was cut.