In 1637, Pierre de Fermat scribbled a tantalizing note in the margin of a book. In 1993, Andrew Wiles emerged from seven years of secret work to attempt the impossible.