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