# nest function

Apply a function again and again to a value.

## How to write it

### nest(f, x, n)

**f**

The function to apply. Takes a function.

**x**

The first value. Takes an expression.

**n**

How many times. Takes a whole number.

## Examples

- $\displaystyle \operatorname{nest}(\operatorname{sqrt}, 16, 2) = 2$

  `nest(sqrt, 16, 2)`

  In the solver, `nest(sqrt, 16, 2)` gives `2`.

  [Open in the solver](https://hilberon.com/?q=nest%28sqrt%2C%2016%2C%202%29)

## Related functions

- [nest_list](https://hilberon.com/library/nest_list)

  The steps of nest: the value after each application, starting from the first.
- [most](https://hilberon.com/library/most)

  A list without its last element.
- [part](https://hilberon.com/library/part)

  Read part of a list by position, counting from 1; also written list\[i\].
- [map_thread](https://hilberon.com/library/map_thread)

  Apply a function to corresponding elements of several lists.
- [partition](https://hilberon.com/library/partition)

  A list split into blocks of a given length.
- [map](https://hilberon.com/library/map)

  Apply a function to every element of a list.

---
Source: https://hilberon.com/library/nest
