For Diophantine representations of perfect numbers, you may visit https://link.springer.com/article/10.1007%2FBF01629440 For Diophantine representations of Mersenne primes and Fermat primes, see http://matwbn.icm.edu.pl/ksiazki/aa/aa35/aa3531.pdf