Pythagoreanism to have survived as part of, or deeply influenced, the Bacchic cults and Orphism. Pythagoras was already in ancient times well known for the mathematical achievement of the Pythagorean theorem. Although the Babylonians had used this formula for centuries, Pythagoras had discovered that "in a right-angled triangle the square of the hypotenuse is equal to the squares of the other two sides". In ancient times Pythagoras was also noted for his discovery that music had mathematical foundations. Antique sources that credit Pythagoras as the philosopher who first discovered music intervals also credit him as the inventor of the monochord, a
Fermat's theorem on sums of two squares he announced the following two results for odd primes formula_4: He also wrote: In other words, if "p, q" are of the form 20"k" + 3 or 20"k" + 7, then "pq" = "x" + 5"y". Euler later extended this to the conjecture that Both Fermat's assertion and Euler's conjecture were established by Lagrange. A generalization of Fermat's theorem, the sum of two squares theorem, characterizes the integers (not necessarily prime) that can be expressed as the sum of two squares. They are exactly the integers in which each prime that is congruent to 3 mod 4 appears with an