Wikipedia: The regular paperfolding sequence, also known as the dragon curve sequence, is an infinite automatic sequence of 0
s and 1
s defined as the limit of the following process:
1
1 1 0
1 1 0 1 1 0 0
1 1 0 1 1 0 0 1 1 1 0 0 1 0 0
At each stage an alternating sequence of 1
s and 0
s is inserted between the terms of the previous sequence.
Define a generator `PaperFold` that sequentially generates the values of this sequence.
It will be tested for up to 1 000 000
values.