2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4141000cf542c50ff26
|
2020-12-16 07:37:30 +00:00
|
|
|
|
title: 问题167:研究Ulam序列
|
2018-10-10 22:03:03 +00:00
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --description--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
对于两个正整数a和b,Ulam序列U(a,b)由U(a,b)1 = a,U(a,b)2 = b定义,对于k> 2,U(a,b) )k是大于U(a,b)(k-1)的最小整数,它可以用一种方式写成U(a,b)的两个不同的先前成员的总和。例如,序列U(1,2)以1,2,3 = 1 + 2,4 = 1 + 3,6 = 2 + 4,8 = 2 + 6,11 = 3 + 8开始; 5不属于它,因为5 = 1 + 4 = 2 + 3有两个表示作为前两个成员的总和,同样7 = 1 + 6 = 3 + 4.找到ΣU(2,2n + 1)k为2≤n≤10,其中k = 1011。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --hints--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
`euler167()`应该返回3916160068885。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
|
assert.strictEqual(euler167(), 3916160068885);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --solutions--
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|