2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f3ec1000cf542c50fefe
|
|
|
|
|
title: 'Problem 127: abc-hits'
|
2020-11-27 18:02:05 +00:00
|
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
|
forumTopicId: 301754
|
2021-01-13 02:31:00 +00:00
|
|
|
|
dashedName: problem-127-abc-hits
|
2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --description--
|
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
The radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
We shall define the triplet of positive integers (a, b, c) to be an abc-hit if:
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
GCD(a, b) = GCD(a, c) = GCD(b, c) = 1
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
|
|
a < b
|
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
a + b = c
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
|
|
rad(abc) < c
|
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
For example, (5, 27, 32) is an abc-hit, because:
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
GCD(5, 27) = GCD(5, 32) = GCD(27, 32) = 1
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
|
|
5 < 27
|
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
5 + 27 = 32
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
rad(4320) = 30 < 32
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
It turns out that abc-hits are quite rare and there are only thirty-one abc-hits for c < 1000, with ∑c = 12523.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
Find ∑c for c < 120000.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
`euler127()` should return 18407904.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
```js
|
|
|
|
|
assert.strictEqual(euler127(), 18407904);
|
|
|
|
|
```
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler127() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler127();
|
|
|
|
|
```
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|