2018-09-30 23:01:58 +01:00
---
id: 5900f5191000cf542c51002b
title: 'Problem 428: Necklace of Circles'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302098
2021-01-13 03:31:00 +01:00
dashedName: problem-428-necklace-of-circles
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2021-07-29 20:14:09 +02:00
Let $a$, $b$ and $c$ be positive numbers.
2020-11-27 19:02:05 +01:00
2021-07-29 20:14:09 +02:00
Let $W$, $X$, $Y$, $Z$ be four collinear points where $|WX| = a$, $|XY| = b$, $|YZ| = c$ and $|WZ| = a + b + c$.
2020-11-27 19:02:05 +01:00
2021-07-29 20:14:09 +02:00
Let $C_{\text{in}}$ be the circle having the diameter $XY$.
2020-11-27 19:02:05 +01:00
2021-07-29 20:14:09 +02:00
Let $C_{\text{out}}$ be the circle having the diameter $WZ$.
2018-09-30 23:01:58 +01:00
2021-07-29 20:14:09 +02:00
The triplet ($a$, $b$, $c$) is called a *necklace triplet* if you can place $k ≥ 3$ distinct circles $C_1, C_2, \ldots, C_k$ such that:
- $C_i$ has no common interior points with any $C_j$ for $1 ≤ i$, $j ≤ k$ and $i ≠ j$,
- $C_i$ is tangent to both $C_{\text{in}}$ and $C_{\text{out}}$ for $1 ≤ i ≤ k$,
- $C_i$ is tangent to $C_{i + 1}$ for $1 ≤ i < k$, and
- $C_k$ is tangent to $C_1$.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not.
2021-07-29 20:14:09 +02:00
< img class = "img-responsive center-block" alt = "a visual representation of a necklace triplet" src = "https://cdn.freecodecamp.org/curriculum/project-euler/necklace-of-circles.png" style = "background-color: white; padding: 10px;" >
Let $T(n)$ be the number of necklace triplets $(a, b, c)$ such that $a$, $b$ and $c$ are positive integers, and $b ≤ n$. For example, $T(1) = 9$, $T(20) = 732$ and $T(3\\,000) = 438\\,106$.
2018-09-30 23:01:58 +01:00
2021-07-29 20:14:09 +02:00
Find $T(1\\,000\\,000\\,000)$.
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-29 20:14:09 +02:00
`necklace(1000000000)` should return `747215561862` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert.strictEqual(necklace(1000000000), 747215561862);
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
function necklace(n) {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
necklace(1000000000)
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```