--- title: Ackermann function id: 594810f028c0303b75339acf challengeType: 5 videoUrl: '' localeTitle: Función ackermann --- ## Description

La función de Ackermann es un ejemplo clásico de una función recursiva, especialmente porque no es una función recursiva primitiva. Crece muy rápidamente en valor, al igual que el tamaño de su árbol de llamadas.

La función de Ackermann se define generalmente de la siguiente manera:

$$ A (m, n) = \ begin {cases} n + 1 & \ mbox {if} m = 0 \\ A (m-1, 1) & \ mbox {if} m> 0 \ mbox {and} n = 0 \\ A (m-1, A (m, n-1)) & \ mbox {if} m> 0 \ mbox {y} n> 0. \ end {cases} $$

Sus argumentos nunca son negativos y siempre termina. Escriba una función que devuelva el valor de $ A (m, n) $. Se prefiere la precisión arbitraria (ya que la función crece tan rápidamente), pero no es obligatoria.

## Instructions
## Tests
```yml tests: - text: ack es una función. testString: 'assert(typeof ack === "function", "ack is a function.");' - text: 'ack(0, 0) debe devolver 1.' testString: 'assert(ack(0, 0) === 1, "ack(0, 0) should return 1.");' - text: 'ack(1, 1) debe devolver 3.' testString: 'assert(ack(1, 1) === 3, "ack(1, 1) should return 3.");' - text: 'ack(2, 5) debe devolver 13.' testString: 'assert(ack(2, 5) === 13, "ack(2, 5) should return 13.");' - text: 'ack(3, 3) debe devolver 61.' testString: 'assert(ack(3, 3) === 61, "ack(3, 3) should return 61.");' ```
## Challenge Seed
```js function ack (m, n) { // Good luck! } ```
## Solution
```js // solution required ```