To find number of years we take LCM of planets revolution times.
Planet's revolution times are given in the chart
Solar System Planet Revolution Time
Earth 1 year
Mars 2 years
Jupiter 12 years
Saturn 30 years
Uranus 84 years
Neptune 165 years
We take LCM of 1,2,12,30,84 and 165
Prime factorization of 2 = 2
Prime factorization of 12 = 2^2 * 3
Prime factorization of 30 = 2 * 3* 5
Prime factorization of 84 = 2^2 * 3 * 7
Prime factorization of 165 = 3*5*11
We take set of prime factors that has highest exponent,
So LCM = 2^2 * 3 * 5 * 7 * 11 = 4620
Therefore it will take 4620 years.