Solved question 12 using prime factorization.