OMG! Star Trek got something wrong.
If we judged each episode on that criteria, we'd have to throw out about ninety percent of it... if not more.
Of course you're right. Except the difference between this episode and 90% of other episodes in Star Trek is that those episodes have a lot more going for it than The Royale. Even if the writers were to correct all the scientific errors, it still would have come off as rather dull episode that you could easily skip over and not miss a thing. Heck, skipping it outright would at least get rid of that theorem bit.