4
$\begingroup$

I have a graphic application to develop which involve many spheres. I should determine then on run time.

Supposing that I have a sphere of radius r, how can I determine the sub set of the sphere surface points that are integer?

E.g., $r = 10$ I can have $(10,0,0), (8,6,0),$ etc.

(Obs.: I really think this is not a programming question, that's why I not posted In stack overflow. If I am wrong, please fell free to warn me that :)

Pedro

  • 8
    See http://projecteuler.net/problem=3602011-12-08

1 Answers 1

1

You could use Euclid's formula: For $m > n, a = m^2 - n^2, b = 2mn, c = m^2 + n^2$ are solutions to $a^2 + b^2 = c^2$.

  • 0
    And then there is the Gauss-Legendre theorem that an integer is the sum of three integer squares if and only if it is not of the form $4^m(8n+7)$.2012-04-07