2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4831000cf542c50ff95
|
2020-12-16 07:37:30 +00:00
|
|
|
|
title: 问题278:半正定的线性组合
|
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
|
|
|
|
给定整数1 <a1 <a2 <... <an的值,考虑线性组合q1a1 + q2a2 + ... + qnan = b,仅使用整数值qk≥0。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
注意,对于给定的ak集合,可能不是b的所有值都是可能的。例如,如果a1 = 5且a2 = 7,则没有q1≥0且q2≥0使得b可以是1,2,3,4,6,8,9,11,13,16,18或23 。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
事实上,23是a1 = 5和a2 = 7的b的最大不可能值。因此,我们称f(5,7)= 23.同样,可以证明f(6,10,15)= 29和f(14,22,77)= 195。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
找到Σf(p *q,p* r,q \* r),其中p,q和r是素数,p <q <r <5000。
|
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
|
|
|
|
`euler278()`应该返回1228215747273908500。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
|
assert.strictEqual(euler278(), 1228215747273908500);
|
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
|
|
|
|
|