What is wrong with doing it mathematically?

long res = (long) Math.floor(Math.exp(Math.log(n)/k));

This is the solution I deduced after mathematical calculations. However, it is not passing the third test. What is wrong with this logic?

So the tester is giving “Wrong Answer” for 3rd test case. However, when I checked it after downloading the test cases input and output, it is showing the same answer as the output file.

no for test case
1000000000000 4

you are getting
999

whereas the answer should be 1000