2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4021000cf542c50ff14
|
2021-11-23 11:06:14 -08:00
|
|
|
|
title: '问题 148:帕斯卡三角形的研究'
|
2018-10-10 18:03:03 -04:00
|
|
|
|
challengeType: 5
|
2021-02-06 04:42:36 +00:00
|
|
|
|
forumTopicId: 301777
|
2021-01-13 03:31:00 +01:00
|
|
|
|
dashedName: problem-148-exploring-pascals-triangle
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --description--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
可以轻易证明,帕斯卡三角形前七行中,没有一个数字可以被 7 整除。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
```
|
2021-02-06 04:42:36 +00:00
|
|
|
|
1
|
|
|
|
|
1 1
|
|
|
|
|
1 2 1
|
|
|
|
|
1 3 3 1
|
|
|
|
|
1 4 6 4 1
|
|
|
|
|
1 5 10 10 5 1
|
|
|
|
|
1 6 15 20 15 6 1
|
2021-11-23 11:06:14 -08:00
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
但是如果我们检查前一百行,会发现在 5050 个数中只有 2361 个数字不能被 7 整除。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
|
# --instructions--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
请找出帕斯卡三角形前十亿(${10}^9$)行中不能被 7 整除的数的个数。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
`entriesOfPascalsTriangle()` 应该返回 `2129970655314432`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```js
|
2021-11-23 11:06:14 -08:00
|
|
|
|
assert.strictEqual(entriesOfPascalsTriangle(), 2129970655314432);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```js
|
2021-11-23 11:06:14 -08:00
|
|
|
|
function entriesOfPascalsTriangle() {
|
2021-01-13 03:31:00 +01:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
entriesOfPascalsTriangle();
|
2021-01-13 03:31:00 +01:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --solutions--
|
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|