login
A334812
a(0) = 0; a(1) = 1; for n > 1, a(n) is the square spiral number obtained from the magnitude of the difference between adjacent horizontal and vertical previously visited square numbers. If only one such adjacent square exists then it takes on that square's number.
1
0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1
OFFSET
0
COMMENTS
As all squares are numbered from the difference between square spiral numbers which are either 0 or 1, all terms in the sequence are 0 or 1.
Inspired by Pascal's Spiral A334742.
LINKS
Scott R. Shannon, Image of the spiral for a 101x101 grid. Black squares = 0 and white squares = 1, The central square a(0) = 0 is shown in red for clarity.
EXAMPLE
The spiral begins:
.
--0---1---0---0---1---1
|
1---1---0---1---0 1
| | |
0 1---1---1 0 1
| | | | |
1 1 0---1 1 1
| | | |
0 1---1---0---0 0
| |
0---1---0---0---0---0
.
a(0) = 0; a(1) = 1 by definition.
a(2) = 1 as it only has one adjacent visited square a(1) = 1 so it takes that number.
a(3) = 1 as it has adjacent visited squares a(2) = 1 and a(0) = 0 and the difference between 1 and 0 is 1.
a(7) = 1 as it has adjacent visited squares a(6) = 1 and a(0) = 0 and the difference between 1 and 0 is 1.
a(8) = 0 as it has adjacent visited squares a(7) = 1 and a(1) = 1 and the difference between 1 and 1 is 0.
a(9) = 0 as it only has one adjacent visited square a(8) = 0 so it takes that number.
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, May 12 2020
STATUS
approved