--- title: Hofstadter Q sequence id: 59637c4d89f6786115efd814 challengeType: 5 videoUrl: '' localeTitle: Sequência de Hofstadter Q --- ## Description

A sequência Hofstadter Q é definida como:

$ Q (1) = Q (2) = 1, \\ Q (n) = Q \ big (nQ (n-1) \ grande) + Q \ big (nQ (n-2)), \ quad n> 2. $

Ele é definido como a sequência de Fibonacci , mas enquanto o próximo termo na seqüência de Fibonacci é a soma dos dois termos anteriores, na seqüência Q os dois termos anteriores informam o quão longe voltar na seqüência Q para encontrar os dois números. para somar para fazer o próximo termo da sequência.

Tarefa: Implementar a equação de Seqüência de Hofstadter Q em JavaScript
## Instructions
## Tests
```yml tests: - text: hofstadterQ é uma função. testString: 'assert(typeof hofstadterQ === "function", "hofstadterQ is a function.");' - text: hofstadterQ() deve retornar integer testString: 'assert(Number.isInteger(hofstadterQ(1000)), "hofstadterQ() should return integer");' - text: hofstadterQ(1000) deve retornar 502 testString: 'assert.equal(hofstadterQ(testCase[0]), res[0], "hofstadterQ(1000) should return 502");' - text: hofstadterQ(1500) deve retornar 755 testString: 'assert.equal(hofstadterQ(testCase[1]), res[1], "hofstadterQ(1500) should return 755");' - text: hofstadterQ(2000) deve retornar 1005 testString: 'assert.equal(hofstadterQ(testCase[2]), res[2], "hofstadterQ(2000) should return 1005");' - text: hofstadterQ(2500) deve retornar 1261 testString: 'assert.equal(hofstadterQ(testCase[3]), res[3], "hofstadterQ(2500) should return 1261");' ```
## Challenge Seed
```js function hofstadterQ (n) { // Good luck! return n; } ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```