Roots of Arbitrary Numbers One day, when I was bored in maths class, I learned of a neat trick for solving the real cube root of a number!

Let's use the number \$79,507\$ as an example.

First, take digit in the one's place and compare it to this table:

\begin{array} {|r|r|}
\hline
\text{Extracted Digit} &amp;\text{Resulting Digit} \\
\hline
\text{1} &amp;\text{1} \\
\text{2} &amp;\text{8} \\
\text{3} &amp;\text{7} \\
\text{4} &amp;\text{4} \\
\text{5} &amp;\text{5} \\
\text{6} &amp;\text{6} \\
\text{7} &amp;\text{3} \\
\text{8} &amp;\text{2} \\
\text{9} &amp;\text{9} \\
\text{0} &amp;\text{0} \\
\hline
\end{array}

In this example, the Resulting Digit will be \$3\$ since the extracted digit is \$7\$.

Next, remove all digits that are less than \$10^3\$:

$$ 79507 → 79 $$

Then, find the largest perfect cube that does not exceed the input:

$$ 64 &lt; 79 $$

\$64=4^3\$, thus the next digit needed is \$4\$.

Finally, multiply the digit found in the previous step by \$10\$ and add the Resulting Digit found in the first step:

$$ 10*4+3=43 $$

Thus, the cube root of \$79,507\$ equals \$43\$.

However, there a neat quirk about this trick: it doesn't apply to only cubed numbers.  In fact, it works with all \$n&gt;1\$ where \$n\bmod2\ne0\$.

The steps mentioned above can be summed up in this generalization for an \$n\$ power:


Step 1) Take the digit in the one's place in the input.  Compare it to the one's place digit of the \$n\$th powers of \$1\$ to \$10\$, then use the corresponding digit.
Step 2) Remove all digits of the input less than \$10^n\$.  Compare the resulting number to the perfect powers definied in Step 1.  Use the \$n\$th root of the largest perfect power less than said number.  (Largest perfect power can exceed \$10^n\$)
Step 3) Multiply the number from Step 2 by 10 then add the number from Step 1.  This will be the final result.


Task

Given two positive integers \$n\$ and \$m\$, return the \$n\$th root of \$m\$.

Input:


Two positive integers \$n\$ and \$m\$.
\$m\$ is guaranteed to be a perfect \$n\$th power of an integer.
\$n\$ is guaranteed to be odd and greater than \$2\$.  (This method doesn't work if \$n\$ is even.)


Output:


The values calculated in steps 1 and 2.
The \$n\$th root of \$m\$.
Output can be on multiples lines or a list, whichever is more convenient.


Rules:


This is code-golf, so the fewer bytes, the better!
Standard I/O rules apply.
The output must be calculated using the aforementioned method.
No builtins allowed that already calculate this.  A prime example being TI-BASIC's x√ command.


Examples:

Input      | Output
-------------------
3, 79507   | 3
           | 4
           | 43
3, 79507   | [3, 4, 43]
5, 4084101 | 1
           | 2
           | 21
5, 4084101 | [1, 2, 21]
05AB1E, 18 bytes

Saved 1 byte thanks to Kevin Cruijssen

mθ=²¹°÷DÝ¹m@O&lt;=ìï=


Try it online!