For Diophantine representations of perfect numbers, you may visitread V.Y. Kryauchyukas, https://link.springer.com/article/10.1007%2FBF01629440Diophantine representation of perfect numbers.
For Diophantine representations of Mersenne primes and Fermat primesJames Jones' Diophantine representations of Mersenne primes and Fermat primes, see http://matwbn.icm.edu.pl/ksiazki/aa/aa35/aa3531.pdf
For universal diophantineDiophantine equation, please consult Jones' paper [Jof that name in J. Symbolic Logic 4747 (1982), 549-571]549–571, doi:10.2307/2273588, also available from https://projecteuclid.org/euclid.jsl/1183741086 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.