2018-09-30 22:01:58 +00:00
---
id: 5900f4511000cf542c50ff62
title: 'Problem 226: A Scoop of Blancmange'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301869
2021-01-13 02:31:00 +00:00
dashedName: problem-226-a-scoop-of-blancmange
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
2021-07-15 12:26:34 +00:00
The blancmange curve is the set of points ($x$,$y$) such that $0 ≤ x ≤ 1$ and $\displaystyle y = \sum_{n = 0}^{\infty} \frac{s(2^nx)}{2^n}$, where $s(x)$ is the distance from $x$ to the nearest integer.
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
The area under the blancmange curve is equal to $\frac{1}{2}$, shown in pink in the diagram below.
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
< img class = "img-responsive center-block" alt = "diagram of blancmange curve, with circle C shown on diagram" src = "https://cdn.freecodecamp.org/curriculum/project-euler/a-scoop-of-blancmange.gif" style = "background-color: white; padding: 10px;" >
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
Let $C$ be the circle with centre ($\frac{1}{4}$,$\frac{1}{2}$) and radius $\frac{1}{4}$, shown in black in the diagram.
What area under the blancmange curve is enclosed by $C$? Give your answer rounded to eight decimal places in the form 0.abcdefgh
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
2021-07-15 12:26:34 +00:00
`scoopOfBlancmange()` should return `0.11316017` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-15 12:26:34 +00:00
assert.strictEqual(scoopOfBlancmange(), 0.11316017);
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
2021-07-15 12:26:34 +00:00
function scoopOfBlancmange() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-15 12:26:34 +00:00
scoopOfBlancmange();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```