freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-175-fractions-invol...

56 lines
1.6 KiB
Markdown
Raw Normal View History

---
id: 5900f41c1000cf542c50ff2e
challengeType: 5
title: 'Problem 175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2'
videoUrl: ''
localeTitle: 问题175涉及不同方式的数量的分数数字可以表示为2的幂的总和
---
## Description
<section id="description">将f0= 1和fn定义为将n作为2的幂之和进行写入的方式的数量其中没有功率发生超过两次。 <p>例如f10= 5因为有五种不同的表达方式10:10 = 8 + 2 = 8 + 1 + 1 = 4 + 4 + 2 = 4 + 2 + 2 + 1 + 1 = 4 + 4 + 1 + 1 </p><p>可以证明对于每个分数p / qp&gt; 0q&gt; 0存在至少一个整数n使得fn/ fn-1= p / q。例如fn/ fn-1= 13/17的最小n是241. 241的二进制扩展是11110001.从最高有效位到最低有效位读取这个二进制数有4个13个零和1个。我们将字符串4,3,1称为缩短的二进制扩展241.找到最小n的缩短二进制扩展其中fn/ fn-1= 123456789/987654321。以逗号分隔的整数给出答案没有任何空格。 </p></section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>euler175()</code>应该返回1,13717420,8。'
testString: 'assert.strictEqual(euler175(), 1, 13717420, 8, "<code>euler175()</code> should return 1, 13717420, 8.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler175() {
// Good luck!
return true;
}
euler175();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>