2018-09-30 23:01:58 +01:00
---
id: 5900f4761000cf542c50ff88
title: 'Problem 265: Binary Circles'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 301914
2021-01-13 03:31:00 +01:00
dashedName: problem-265-binary-circles
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2021-07-24 09:09:54 +02:00
$2^N$ binary digits can be placed in a circle so that all the $N$-digit clockwise subsequences are distinct.
2018-09-30 23:01:58 +01:00
2021-07-24 09:09:54 +02:00
For $N = 3$, two such circular arrangements are possible, ignoring rotations:
< img class = "img-responsive center-block" alt = "two circular arrangements for N = 3" src = "https://cdn.freecodecamp.org/curriculum/project-euler/binary-circles.gif" style = "background-color: white; padding: 10px;" >
2018-09-30 23:01:58 +01:00
For the first arrangement, the 3-digit subsequences, in clockwise order, are: 000, 001, 010, 101, 011, 111, 110 and 100.
2021-07-24 09:09:54 +02:00
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for $N = 3$ are thus represented as 23 and 29:
$${00010111}_2 = 23\\\\
{00011101}_2 = 29$$
2018-09-30 23:01:58 +01:00
2021-07-24 09:09:54 +02:00
Calling $S(N)$ the sum of the unique numeric representations, we can see that $S(3) = 23 + 29 = 52$.
2018-09-30 23:01:58 +01:00
2021-07-24 09:09:54 +02:00
Find $S(5)$.
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-24 09:09:54 +02:00
`binaryCircles()` should return `209110240768` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-24 09:09:54 +02:00
assert.strictEqual(binaryCircles(), 209110240768);
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-24 09:09:54 +02:00
function binaryCircles() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-24 09:09:54 +02:00
binaryCircles();
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
```