login
The diagonal of the order of square grid cells touched by a circle expanding from the middle of a cell.
4

%I #12 Feb 15 2019 14:58:06

%S 0,2,5,10,16,22,32,40,50,62,73,88,101,118,134,152,170,189,210,230,253,

%T 275,299,325,351,381,406,435,465,495,527,561,593,628,663,699,737,775,

%U 813,853,895,935,981,1021,1068,1113,1156,1205,1253,1302,1352,1401,1454,1502,1557,1609,1664,1723

%N The diagonal of the order of square grid cells touched by a circle expanding from the middle of a cell.

%C Related to, but not the same as the case with the circle centered at the corner of a cell, see A232499.

%H Rok Cestnik, <a href="/A323621/a323621_1.gif">Visualization</a>

%o (Python)

%o N = 12

%o from math import sqrt

%o # the distance to the edge of each cell

%o edges = [[-1 for j in range(N)] for i in range(N)]

%o edges[0][0] = 0

%o for i in range(1,N):

%o edges[i][0] = i-0.5

%o edges[0][i] = i-0.5

%o for i in range(1,N):

%o for j in range(1,N):

%o edges[i][j] = sqrt((i-0.5)**2+(j-0.5)**2)

%o # the values of the distances

%o values = []

%o for i in range(N):

%o for j in range(N):

%o values.append(edges[i][j])

%o values = list(set(values))

%o values.sort()

%o # the cell order

%o board = [[-1 for j in range(N)] for i in range(N)]

%o count = 0

%o for v in values:

%o for i in range(N):

%o for j in range(N):

%o if(edges[i][j] == v):

%o board[i][j] = count

%o count += 1

%o # print out the sequence

%o for i in range(N):

%o print(str(board[i][i])+",", end="")

%Y For the grid read by antidiagonals see A323621.

%Y For the first row of the grid see A323622.

%Y For the second row of the grid see A323623.

%Y For the (2,1) diagonal of the grid see A323625.

%Y Cf. A232499.

%K nonn

%O 0,2

%A _Rok Cestnik_, Jan 20 2019