Challenge
Generate the 2D sequence of bits of A141727. (Allowed I/O methods explained at the bottom.)
1
1 0 1
1 0 0 1 0
1 0 1 0 1 0 0
1 0 0 1 1 0 1 1 1
1 0 1 0 0 0 0 0 1 1 0
1 0 0 1 0 0 0 0 1 1 1 0 0
1 0 1 0 1 0 0 0 1 1 0 0 1 1 1
1 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0
1 0 1 0 0 0 0 0 0 1 1 0 1 0 1 1 1 0 0
This triangle is generated as follows: starting with a row of single 1, generate the bits row-by-row, from left to right. Each bit is the parity of the sum (in other words, XOR-sum) of the neighboring bits already placed (8-way neighborhood).
[1] initial condition
1
[1]? ? only one neighbor being 1, sum is 1
1
1[0]? two 1-neighbors, sum is 0
1
1 0[1] two neighbors (0 and 1), sum is 1
1
1 0 1
[1]? ? ? ? one neighbor, sum 1
1
1 0 1
1[0]? ? ? three neighbors, sum 0
1
1 0 1
1 0[0]? ? four neighbors, sum 0
1
1 0 1
1 0 0[1]? three neighbors, sum 1
1
1 0 1
1 0 0 1[0] two neighbors, sum 0
...
sequence default I/O methods apply. In this challenge, you can interpret the sequence as a sequence of individual bits or a sequence of rows of bits, so the following are accepted:
- Given
n
(0- or 1-indexed), outputn
-th bit orn
-th row - Given
n
(positive), output firstn
bits or firstn
rows - Given no input, output the infinite sequence of bits or the sequence of rows (refer to sequence rules for exactly which methods count as infinite output)
Standard code-golf rules apply. The shortest code in bytes wins.