For Diophantine representations of perfect numbers, you may read V.Y. Kryauchyukas, Diophantine representation of perfect numbers.
For James Jones' Diophantine representations of Mersenne primes and Fermat primes, see http://matwbn.icm.edu.pl/ksiazki/aa/aa35/aa3531.pdf
For universal Diophantine equation, please consult Jones' paper of that name in J. Symbolic Logic 47 (1982), 549–571, doi:10.2307/2273588, also available from https://www.jstor.org/stable/2273588.
Jones' paper in 1982 contains a general method to transform any polynomial Diophantine equation over $\mathbb N=\{0,1,\ldots\}$ to one with at most 9 natural number unknowns.