login
A157196
a(n) = (1/2)*(sum of elements of n-th run) using 1 and 2 starting with 1,1.
14
1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1
OFFSET
1,3
COMMENTS
We conjecture that the density of 1's in the sequence approaches 2/3 as n -> infinity. This conjecture is proved in the paper of Shallit.
From Daniel Hoyt, Sep 05 2025: (Start)
This sequence lists the run lengths of the first absolute differences of the dragon curve, the regular paper-folding sequence (A014577).
The blocks of (1, 1) and (2) of this sequence interleave central binomial coefficients in the continued fraction of Sum_{k>=0} 1/(2^k)! (see A387398). (End)
From Daniel Hoyt, Nov 21 2025: (Start)
A paperfolding construction: Use the binary alphabet (11, 2), where the symbol "11" stands for two consecutive 1's and "2" stands for a single 2. For a word W, let rev(W) be W reversed. Let revflip(W) be rev(W) with its first symbol flipped (11 <-> 2). Let "+" be used for concatenation.
Seed: A0 = 11.
Recursive step: A_{k+1} = A_k + revflip(A_k).
Examples:
A0 = 11
A1 = 112 (rev(11)=11; flip first 11->2; append 2)
A2 = 1121111 (rev(112)=211; flip first 2->11; append 1111)
A3 = 1121111211211 (rev(1121111)=1111211; flip first 11->2; append 211211)
A4 = 1121111211211221121111211 (and so on)
From A3 onward the first symbol of rev(A_k) is always "11", so the flip is always 11->2. The limit of A_k is exactly this sequence. (End)
LINKS
Benoit Cloitre and Jeffrey Shallit, A Self-Generating Sequence, Theoret. Comp. Sci. (2025) 115721.
Daniel Hoyt, The Self-Describing Paperfolding Sequence in Continued Fractions, J. Int. Seq. 29 (2026), Art. 26.3.6.
Jeffrey Shallit, Cloitre's Self-Generating Sequence, arXiv:2501.00784 [math.CO], 2025.
EXAMPLE
Write the sums of elements in each run, you obtain: 2,2,4,2,2,2,2,4,2,2,4,2,2,4,4,... dividing by 2 you get: 1,1,2,1,1,1,1,2,1,1,2,1,1,2,2,... the sequence itself.
MAPLE
mx:= 1000: l:= [1$2]: a:= n-> l[n]:
for h from 2 while nops(l)<mx do
t:= 2-irem(h, 2); l:= [l[], t$(l[h]*2/t)]
od:
seq (a(n), n=1..120); # Alois P. Heinz, May 31 2012
PROG
(Python)
def a157196(n):
blk = ['11'] # A_0
while sum(map(len, blk)) < n: # grow until we have >= n digits
b = list(reversed(blk))
b[0] = '11' if b[0] == '2' else '2' # flip first block of the mirror
blk += b
print(', '.join(''.join(blk)[:n]))
a157196(100) # Number of digits
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Benoit Cloitre, Feb 24 2009
EXTENSIONS
More terms from Alvin Hoover Belt, May 31 2012
STATUS
approved