\\ * * * * * * * * * * * * * * * \\ coordination sequence library \\ * * * * * * * * * * * * * * * width = -1 height = -1 coord = matrix(0,0) init(w, h) = { width = w; height = h; coord = matrix(width, height, x, y, []); } up (z) = z + I*height down (z) = z - I*height right(z) = z + width left (z) = z - width \\ unidirectional link link1(z, zz) = { my (x=real(z) % width, y=imag(z) % height); coord[1+x, 1+y] = concat(coord[1+x, 1+y], zz-z); } \\ bidirectional link link(a, b) = link1(a, b); link1(b, a); \\ neighbours neighbours(z) = { my (x=real(z) % width, y=imag(z) % height); my (n = apply (c -> c + z, coord[1+x, 1+y])); \\ print ("#" z " -> " n); return (n); } \\ compute first terms compute(z, mx) = { my (explored = Set()); my (current = Set(z)); for (n=0, mx, \\ print ("#" current); print (n " " #current); if (n==mx, break); explored = set union(explored, current); my (others = concat(apply(neighbours, current))); current = set minus(Set(others), explored); ); } \\ A301672 Coordination sequence for node of type V2 in "krr" 2-D tiling (or net). init(12, 12) A = 3*I B = 3 + 6*I C = 9 + 6*I D = 3 E = 9 link(A, B) link(A, D) link(A, left(C)) link(A, left(E)) link(B, up(D)) link(B, D) link(B, C) link(C, up(E)) link(C, E) link(D, E) allocate mem(2^30) compute(A, 1 000) quit