Designate the number under the root, select the factors that come out in pairs, and leave the rest under the root.
√800 = √ (2 x 2 x 2 x 2 x 5 x 2 x 5) = √ (2 2 x 2 2 x 5 2 x 2) = (2 x 2 x 5) √2 = 20√2.
And for completeness, there is a simple code here:
outside_root = 1 inside_root = 800 d = 2 while (d * d <= inside_root): if (inside_root % (d * d) == 0): # inside_root evenly divisible by d * d inside_root = inside_root / (d * d) outside_root = outside_root * d else: d = d + 1
when the algorithm completes, external_root and inside_root contain the answer.
Here's a run from 800:
inside outside d 800 1 2
The answer 20√2 is here on the last line.
source share