Fermat's Theorem, its riddle and endless search for a solution occupy a unique position in mathematics in many ways. Despite the fact that a simple and elegant solution was never found, this problem served as an impetus for a number of discoveries in the field of the theory of sets and prime numbers