2018-09-30 23:01:58 +01:00
---
id: 5900f4d41000cf542c50ffe7
title: 'Problem 360: Scary Sphere'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302021
2021-01-13 03:31:00 +01:00
dashedName: problem-360-scary-sphere
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Given two points ($x_1$, $y_1$, $z_1$) and ($x_2$, $y_2$, $z_2$) in three dimensional space, the Manhattan distance between those points is defined as $|x_1 - x_2| + |y_1 - y_2| + |z_1 - z_2|$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Let $C(r)$ be a sphere with radius $r$ and center in the origin $O(0, 0, 0)$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Let $I(r)$ be the set of all points with integer coordinates on the surface of $C(r)$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Let $S(r)$ be the sum of the Manhattan distances of all elements of $I(r)$ to the origin $O$.
E.g. $S(45)=34518$.
Find $S({10}^{10})$.
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 19:14:22 +02:00
`scarySphere()` should return `878825614395267100` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-29 19:14:22 +02:00
assert.strictEqual(scarySphere(), 878825614395267100);
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-29 19:14:22 +02:00
function scarySphere() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-29 19:14:22 +02:00
scarySphere();
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
```