freeCodeCamp/curriculum/challenges/spanish/08-coding-interview-prep/project-euler/problem-40-champernownes-co...

60 lines
1.8 KiB
Markdown
Raw Normal View History

2018-10-08 17:34:43 +00:00
---
2018-10-10 20:20:40 +00:00
id: 5900f3941000cf542c50fea7
2018-10-08 17:34:43 +00:00
challengeType: 5
title: 'Problem 40: Champernowne"s constant'
2018-10-10 20:20:40 +00:00
videoUrl: ''
localeTitle: 'Problema 40: constante de Champernowne'
2018-10-08 17:34:43 +00:00
---
## Description
2018-10-10 20:20:40 +00:00
<section id="description"> Una fracción decimal irracional se crea mediante la concatenación de los números enteros positivos: <span style="display: block; text-align: center;"><b style="color: red;">1</b> 0.12345678910 112131415161718192021 ...</span> Se puede observar que el 12 <sup>de</sup> dígitos de la parte fraccionaria es 1. Si <i>d <sub>n</sub></i> representa el <i><sup>enésimo</sup></i> dígitos de la parte fraccionaria, encontrar el valor de la siguiente expresion <span style="display: block; text-align: center;">d <sub>1</sub> × d <sub>10</sub> × d <sub>100</sub> × d <sub>1000</sub> × d <sub>10000</sub> × d <sub>100000</sub> × d <sub>1000000</sub></span> </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>champernownesConstant(100)</code> debe devolver 5.
testString: 'assert.strictEqual(champernownesConstant(100), 5, "<code>champernownesConstant(100)</code> should return 5.");'
- text: <code>champernownesConstant(1000)</code> debe devolver 15.
testString: 'assert.strictEqual(champernownesConstant(1000), 15, "<code>champernownesConstant(1000)</code> should return 15.");'
- text: <code>champernownesConstant(1000000)</code> debe devolver 210.
testString: 'assert.strictEqual(champernownesConstant(1000000), 210, "<code>champernownesConstant(1000000)</code> should return 210.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function champernownesConstant(n) {
// Good luck!
return true;
}
champernownesConstant(100);
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>