2018-10-08 17:34:43 +00:00
---
title: Iterated digits squaring
id: 5a23c84252665b21eecc7ec1
challengeType: 5
2018-10-10 20:20:40 +00:00
videoUrl: ''
localeTitle: Dígitos iterados en cuadratura
2018-10-08 17:34:43 +00:00
---
## Description
2018-10-10 20:20:40 +00:00
< section id = "description" > Si agrega el cuadrado de los dígitos de un número natural (un entero más grande que cero), siempre termina con 1 u 89: < pre > 15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
7 -> 49 -> 97 -> 130 -> 10 -> 1 < / pre > Escriba una función que tome un número como parámetro y devuelva 1 u 89 después de realizar el proceso mencionado. < / section >
2018-10-08 17:34:43 +00:00
## Instructions
2018-10-10 20:20:40 +00:00
< section id = "instructions" >
2018-10-08 17:34:43 +00:00
< / section >
## Tests
< section id = 'tests' >
```yml
tests:
- text: < code > iteratedSquare</ code > debería ser una función.
testString: 'assert(typeof iteratedSquare=="function","< code > iteratedSquare< / code > should be a function.");'
- text: < code > iteratedSquare(4)</ code > debe devolver un número.
testString: 'assert(typeof iteratedSquare(4)=="number","< code > iteratedSquare(4)< / code > should return a number.");'
- text: < code > iteratedSquare(4)</ code > debe devolver < code > 89</ code > .
testString: 'assert.equal(iteratedSquare(4),89,"< code > iteratedSquare(4)< / code > should return < code > 89< / code > .");'
- text: < code > iteratedSquare(7)</ code > debe devolver < code > 1</ code > .
testString: 'assert.equal(iteratedSquare(7),1,"< code > iteratedSquare(7)< / code > should return < code > 1< / code > .");'
- text: < code > iteratedSquare(15)</ code > debe devolver < code > 89</ code > .
testString: 'assert.equal(iteratedSquare(15),89,"< code > iteratedSquare(15)< / code > should return < code > 89< / code > .");'
- text: < code > iteratedSquare(20)</ code > debe devolver < code > 89</ code > .
testString: 'assert.equal(iteratedSquare(20),89,"< code > iteratedSquare(20)< / code > should return < code > 89< / code > .");'
- text: < code > iteratedSquare(70)</ code > debe devolver < code > 1</ code > .
testString: 'assert.equal(iteratedSquare(70),1,"< code > iteratedSquare(70)< / code > should return < code > 1< / code > .");'
- text: < code > iteratedSquare(100)</ code > debe devolver < code > 1</ code > .
testString: 'assert.equal(iteratedSquare(100),1,"< code > iteratedSquare(100)< / code > should return < code > 1< / code > .");'
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function iteratedSquare (n) {
// Good luck!
}
2018-10-10 20:20:40 +00:00
2018-10-08 17:34:43 +00:00
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
2018-10-10 20:20:40 +00:00
// solution required
2018-10-08 17:34:43 +00:00
```
< / section >