# Reliable integer root function?

Does Sage have an integer_root(x, n) function which reliable (!) returns floor(root(x,n)) for n-th roots? I think that it should be offered as a Sage function if not.

This seems to work:

```
def integer_root(x, n): return gp('sqrtnint(%d,%d)' %(x,n))
```

Integer n-th root of x, where x is non-negative integer.

// Related: question 10730.

**Edit:** The answer of castor below shows a second way to define such a function:

```
def integer_root(x, n): return ZZ(x).nth_root(n, truncate_mode=1)[0]
```

Which version will be faster?

This exists at least for square roots: it is called

`sqrtrem()`

and also provides the remainder.