

A239318


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


0



1, 3, 6, 6, 7, 10, 12, 12, 15, 15, 18, 18, 21, 22, 25, 25, 28, 30, 30, 33, 33, 36, 39, 39, 39, 42, 42, 43, 43, 46, 49, 49, 52, 52, 54, 57, 57, 60, 63, 66, 66, 66, 66, 69, 69, 72, 72, 73, 76, 79, 79, 82, 82, 82, 82, 87, 90, 93, 93, 93, 93, 96, 96, 99, 99, 102
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

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.


LINKS

Table of n, a(n) for n=1..66.


PROG

(C)
void printVisibleCubes(int nr)
{
int prev_c = 0;
for (int r = 3; nr > 0; r++)
{
int c = 0;
int c2 = 0;
for (int i = 1; i*i + 2 <= r; i++)
for (int j = 1; i*i + j*j + 1 <= r; j++)
for (int k = 1; i*i + j*j + k*k <= r; k++)
{
c++;
if ( (i+1)*(i+1) + j*j + k*k > r
 i*i + (j+1)*(j+1) + k*k > r
 i*i + j*j + (k+1)*(k+1) > r)
c2++;
}
if (c > prev_c)
{
// c contains next element of A237707
printf("%d, ", c2);
prev_c = c;
nr;
}
}
}


CROSSREFS

Cf. A237707.
Sequence in context: A296216 A072910 A130482 * A177783 A228945 A178746
Adjacent sequences: A239315 A239316 A239317 * A239319 A239320 A239321


KEYWORD

nonn


AUTHOR

Frans Faase, Mar 15 2014


STATUS

approved



