Files

49 lines
951 B
Markdown
Raw Permalink Normal View History

---
id: 5900f4d41000cf542c50ffe7
title: 'Problem 360: Scary Sphere'
challengeType: 5
forumTopicId: 302021
dashedName: problem-360-scary-sphere
---
# --description--
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|$.
Let $C(r)$ be a sphere with radius $r$ and center in the origin $O(0, 0, 0)$.
Let $I(r)$ be the set of all points with integer coordinates on the surface of $C(r)$.
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})$.
# --hints--
`scarySphere()` should return `878825614395267100`.
```js
assert.strictEqual(scarySphere(), 878825614395267100);
```
# --seed--
## --seed-contents--
```js
function scarySphere() {
return true;
}
scarySphere();
```
# --solutions--
```js
// solution required
```