K-Th Root

You will be given Q queries. In each query, you will be given two positive integers A and B. You have to find such positive integer K that there exist a positive integer N and NK = AB. If there exists multiple possible values for K, take the maximum of them.


This is a companion discussion topic for the original entry at https://toph.co/p/k-th-root

What’s the answer for this test?
9 6