--- id: 5900f3941000cf542c50fea7 challengeType: 5 title: 'Problem 40: Champernowne"s constant' videoUrl: '' localeTitle: 问题40:Champernowne的常数 --- ## Description
通过连接正整数创建无理小数: 0.12345678910 1 112131415161718192021 ...可以看出小数部分的 12位是1.如果d n代表小数部分的 n位,找到值以下表达式。 d 1 ×d 10 ×d 100 ×d 1000 ×d 10000 ×d 100000 ×d 1000000
## Instructions
## Tests
```yml tests: - text: champernownesConstant(100)应该返回5。 testString: 'assert.strictEqual(champernownesConstant(100), 5, "champernownesConstant(100) should return 5.");' - text: champernownesConstant(1000)应该返回15。 testString: 'assert.strictEqual(champernownesConstant(1000), 15, "champernownesConstant(1000) should return 15.");' - text: champernownesConstant(1000000)应该返回210。 testString: 'assert.strictEqual(champernownesConstant(1000000), 210, "champernownesConstant(1000000) should return 210.");' ```
## Challenge Seed
```js function champernownesConstant(n) { // Good luck! return true; } champernownesConstant(100); ```
## Solution
```js // solution required ```