DEV Community


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.

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

Print the minimum number X modulo 10^9 + 7

Sample Input

12 2

Sample Output


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

Top comments (1)

Sloan, the sloth mascot
Comment deleted

50 CLI Tools You Can't Live Without

The top 50 must-have CLI tools, including some scripts to help you automate the installation and updating of these tools on various systems/distros.