The main editor of the mathematical journal "Formulist," Philipp Dorofeev, is murdered. Before his death, Philipp manages to leave a message in the form of a mathematical formula, which serves as a reference to the famous Fermat's theorem. Soon after the murder, the employees of the editorial office find new messages, and each of them is a variant of the solution to Fermat's theorem. Investigator Kartashova brings Olga Barkovskaya into the investigation, and she quickly realizes that the author of the messages is using formulas to point the investigation towards the members of a secret club of Fermatists, founded by Philipp Dorofeev. Olga is asked to write an article for the "Formulist" journal in order to interact with the victim's colleagues and deduce the identities of the Fermatists, as only then will she understand who is leaving the messages and why.