DEV Community

aryanarya
aryanarya

Posted on

Daily Coding - DAY-1 # Math

Finding the ways
You are given an integer N and a value k . You need to find a minimum number X which when multiplied to N results in the value of N^(1/k) as an integer.

For example let N =6 and k=2 , then the answer will be 6 because 6*6 =36 and if we calculate 36^(1/2) it is equal to 6 which is an integer.

Input
The first line contains two space-separated values N and 6 as input.

Output
Print the minimum number X modulo 10^9 + 7

Sample Input

12 2

Sample Output

3

If you multiply 6 with 6 then the result becomes 36 which is a perfect power of 2 .

Top comments (1)

Collapse
 
Sloan, the sloth mascot
Comment deleted