2021-05-05 10:13:49 -07:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4021000cf542c50ff14
|
2021-11-23 11:06:14 -08:00
|
|
|
|
title: '問題 148:帕斯卡三角形的研究'
|
2021-05-05 10:13:49 -07:00
|
|
|
|
challengeType: 5
|
|
|
|
|
forumTopicId: 301777
|
|
|
|
|
dashedName: problem-148-exploring-pascals-triangle
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
可以輕易證明,帕斯卡三角形前七行中,沒有一個數字可以被 7 整除。
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
```
|
2021-05-05 10:13:49 -07: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
|
|
|
|
```
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
但是如果我們檢查前一百行,會發現在 5050 個數中只有 2361 個數字不能被 7 整除。
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
請找出帕斯卡三角形前十億(${10}^9$)行中不能被 7 整除的數的個數。
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
`entriesOfPascalsTriangle()` 應該返回 `2129970655314432`。
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
|
|
|
|
```js
|
2021-11-23 11:06:14 -08:00
|
|
|
|
assert.strictEqual(entriesOfPascalsTriangle(), 2129970655314432);
|
2021-05-05 10:13:49 -07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```js
|
2021-11-23 11:06:14 -08:00
|
|
|
|
function entriesOfPascalsTriangle() {
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 11:06:14 -08:00
|
|
|
|
entriesOfPascalsTriangle();
|
2021-05-05 10:13:49 -07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|