Charles Babbage , olhando para os problemas que seu Mecanismo Analítico poderia resolver, deu o seguinte exemplo:
Qual é o menor inteiro positivo cujo quadrado termina nos dígitos 269.696?
- Babbage, carta a Lord Bowden, 1837; veja Hollingdale e Tootill, Electronic Computers , segunda edição, 1970, p. 125
Ele pensou que a resposta poderia ser 99.736, cujo quadrado é 9.947.269.696; mas ele não podia ter certeza.
A tarefa é descobrir se Babbage teve a resposta certa.
Implemente uma função para retornar o inteiro mais baixo que satisfaça o problema Babbage. Se Babbage estava certo, devolva o número de Babbage.
babbage
é uma função.
testString: 'assert(typeof babbage === "function", "babbage
is a function.");'
- text: 'babbage(99736, 269696)
não deve retornar 99736 (há uma resposta menor).'
testString: 'assert.equal(babbage(babbageAns, endDigits), answer, "babbage(99736, 269696)
should not return 99736 (there is a smaller answer).");'
```