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
For universal diophantine equation, please consult Jones' paper [J. Symbolic Logic 47(1982), 549-571] available from https://projecteuclid.org/euclid.jsl/1183741086.
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.