In fairness, Wiles published his proof in 1995, and when this episode came out in 1989 nobody knew he was even working in it.
I know that was the case, which is why I thought it was silly for the writers to think that humanity would be able to create warp drive, transporter technology, holographic technology, replicators and even time machines.... but not figure out that bloody theorem.
Eh. It's not such a problem for me. As of the time of the episode, FLT had stymied mathematicians for over 350 years, and there was no clear indication we were any closer to a solution than Fermat. For a lay audience, it's not too much of a stretch to imagine it continuing to elude solution for another few centuries.
Depicting the future as unrealistically similar to the present is always part of Trek, and it's unavoidable.
One of my favorite examples is combat. 24th century people use phasers pretty much the same way 20th century people used guns: you hold it in your hand, point at the target, and push the trigger. You can't really shoot without opening yourself to return fire from the same direction; if you're "pinned down" by cover fire, you're effectively prevented from shooting the enemy. Hitting a small moving target takes great skill, so Picard and Riker spend time practicing it on the holodeck.
Realistically speaking, weapons like the EP-607 will be developed long before the 24th century. Computer intelligence will be able to aim the weapon far more quickly and accurately than any (unaugmented) human possibly could. It will be able to move to firing position without being held in the hand of the operator and without a direct line of sight from the operator's eye to the target, so the operator won't have to expose himself to return fire.
Creating a believable depiction of 24th century combat is beyond us, or at least beyond the makers of Star Trek, so they just depict it as the same as 20th century combat, but with guns that are "futuristic" because they fire energy beams instead of metal projectiles.
Is it fair to expect the Star Trek writers to identify a math problem that realistically might be frustrating 24th century mathematicians? Of course not. Frankly, there probably won't be any—the technological singularity will have long since obsoleted the practice of developing new math with the organic brain of Homo sapiens. But an accurate portrayal of the post-singularity world is not what we're going to see in Star Trek. In Star Trek, we'll see people in the far future struggling with the same kinds of problems that we struggle with today. Showing them struggle with FLT is a reasonable artistic choice that is consistent with Star Trek standard practices as a whole.