P360
projecteuler.net

Scary Sphere

ℹ️Published on Sunday, 27th November 2011, 01:00 am; Solved by 651;
Difficulty rating: 50%

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})$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.