login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A239318 Number of visible unit cubes, aligned with a three-dimensional Cartesian mesh, completely within the first octant of a sphere centered at the origin, ordered by increasing radius. 0

%I #7 Mar 25 2014 00:00:15

%S 1,3,6,6,7,10,12,12,15,15,18,18,21,22,25,25,28,30,30,33,33,36,39,39,

%T 39,42,42,43,43,46,49,49,52,52,54,57,57,60,63,66,66,66,66,69,69,72,72,

%U 73,76,79,79,82,82,82,82,87,90,93,93,93,93,96,96,99,99,102

%N Number of visible unit cubes, aligned with a three-dimensional Cartesian mesh, completely within the first octant of a sphere centered at the origin, ordered by increasing radius.

%C This sequence is related to A237707, which gives all unit cubes. For each element in that sequence, this sequence gives the number of cubes that have at least one side that is visible from the sphere.

%o (C)

%o void printVisibleCubes(int nr)

%o {

%o int prev_c = 0;

%o for (int r = 3; nr > 0; r++)

%o {

%o int c = 0;

%o int c2 = 0;

%o for (int i = 1; i*i + 2 <= r; i++)

%o for (int j = 1; i*i + j*j + 1 <= r; j++)

%o for (int k = 1; i*i + j*j + k*k <= r; k++)

%o {

%o c++;

%o if ( (i+1)*(i+1) + j*j + k*k > r

%o || i*i + (j+1)*(j+1) + k*k > r

%o || i*i + j*j + (k+1)*(k+1) > r)

%o c2++;

%o }

%o if (c > prev_c)

%o {

%o // c contains next element of A237707

%o printf("%d, ", c2);

%o prev_c = c;

%o nr--;

%o }

%o }

%o }

%Y Cf. A237707.

%K nonn

%O 1,2

%A _Frans Faase_, Mar 15 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 12:14 EDT 2024. Contains 371792 sequences. (Running on oeis4.)