On the inverse Fermat equation