2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4091000cf542c50ff1c
|
2020-12-16 07:37:30 +00:00
|
|
|
|
title: 问题157:解决丢番图方程
|
2018-10-10 22:03:03 +00:00
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
2021-01-13 02:31:00 +00:00
|
|
|
|
dashedName: problem-157-solving-the-diophantine-equation
|
2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --description--
|
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
491/5000
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
考虑具有a,b,p,n个正整数且a≤b的双色子方程1 / a + 1 / b = p / 10n。
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
对于n = 1,此等式有20个解决方案,如下所示:
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/1 + 1/1 = 20/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/1 + 1/2 = 15/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/1 + 1/5 = 12/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/1 + 1/10 = 11/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/2 + 1/2 = 10/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/2 + 1/5 = 7/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/2 + 1/10 = 6/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/3 + 1/6 = 5/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/3 + 1/15 = 4/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/4 + 1/4 = 5/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/4 + 1/20 = 3/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/5 + 1/5 = 4/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/5 + 1/10 = 3/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/6 + 1/30 = 2/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/10 + 1/10 = 2/10
|
2020-12-16 07:37:30 +00:00
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
1/11 + 1/110 = 1/10
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
1/12 + 1/60 = 1/10
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
1/14 + 1/35 = 1/10
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
1/15 + 1/30 = 1/10
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
1/20 + 1/20 = 1/10
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
对于1≤n≤9,该方程有多少个解?
|
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
|
|
|
|
`euler157()`应返回53490。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
|
assert.strictEqual(euler157(), 53490);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler157() {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler157();
|
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --solutions--
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|