how to calculate the second to ninth root of a number I'm a CS student and i got this question in my C++ assignment and i don't understand the math behind it.
the question is:

For a natural number m we define its n-th root to be the natural number k that exists That-n k is closer to m than any nth power of any other natural number 'k.


for example:
A. What is the tenth root of a hundred?
In other words: what is the number x so that: 10 near x to a hundred more than any other number to the power of ten?
The answer: 1.
B. What is the third root of a hundred? What is the number whose third power is close to one hundred More than any other number in the third?
The answer: 5.

Write a program that reads a natural number. The plan must present its second to ninth roots of the number.
I didn't understand how they say they define the nth root of a number and the examples provided didn't help me understand it.
hope that someone has an idea so i understand what the program I'm coding is supposed to do.
 A: Obviously, this is not the standard definition of the $n$th root in mathematics, so I will not use the $\sqrt[n]{\cdot}\ $ notation.
Lets say we want to compute the $3$rd root of $100$. We need to find the integer $x$ such that for all other integers $y$, we have that $x^3$ is closer to $100$ than $y^3$. "Closer" here, I believe, means the distance in terms of the absolute value of the difference of the two numbers.
If we make a list:
\begin{align}
1^3 &= 1  & |100-1| &= 99\\
2^3 &= 8  & |100-8| &= 92\\
3^3 &= 27 & |100-27| &= 73\\
4^3 &= 64 & |100-64| &= 36 \\
5^3 &= 125& |100-125| &= 25\\
6^3 &= 216& |100-216| &= 116
\end{align}
Since $5^3$ is closer to $100$ than any other, $5$ is the $3$rd root of $100$.
A: The English and mathematics in the question as quoted is close to nonsense, but I think I know what the author meant to say.

The $n$th root of $m$ is the integer $k$ that minimizes $$ | k^n - m
 |. $$

So to find the $3$d root of $100$ you look at the sequence of cubes
$$
1, 8 = 2^3, 27 = 3^3, 64 =4^3, 125 = 5^3
$$
The closest cube to $100$ is $5^3 = 125$ so this "cube root of $100$" is $5$.
(Building that sequence is probably not the best way to calculate the answer in a program.)
A: In math we define the $n^{th}$ root of $k$ to be the number that when multiplied by itself $n$ times results in $k$.  We write this $m=\sqrt[n]k$.  For many $n,k$ pairs this will not be an integer, it will be an irrational number.  For your example $\sqrt[10]{100} \approx 1.58489$  They want the result to be an integer, so they define it to be so with a particular rounding.  You are expected to find that $1^{10}=1, 2^{10}=1024,$ that $1$ is closer to $100$ than $1024$ is, and return $1$.  For the second example, $4^3=64, 5^3=125$ so you return $5$.
