In this talk we will discuss how Euclid's description of the integer solutions to the equation x2 + y2 = z2 can be found by applying unique factorization to the set of complex numbers of the form a+bi with a, b integers, and how this method generalizes to Lame's approach to Fermat's last theorem. After discussing briefly Lame's approach, we will see an example of how unique factorization may fail for certain sets of complex numbers, and how Kummer thought of his ideal complex numbers. We will then see how his intuitive idea became rigorous and turned into the notion of an ideal of a ring. We will then finish by talking about unique factorization of ideals, a fact that is true, but unfortunately did not lead to a proof of Fermat's last theorem.