cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A080426 a(1)=1, a(2)=3; all terms are either 1 or 3; each run of 3's is followed by a run of two 1's; and a(n) is the length of the n-th run of 3's.

This page as a plain text file.
%I A080426 #97 Apr 22 2025 03:49:10
%S A080426 1,3,1,1,3,3,3,1,1,3,1,1,3,1,1,3,3,3,1,1,3,3,3,1,1,3,3,3,1,1,3,1,1,3,
%T A080426 1,1,3,3,3,1,1,3,1,1,3,1,1,3,3,3,1,1,3,1,1,3,1,1,3,3,3,1,1,3,3,3,1,1,
%U A080426 3,3,3,1,1,3,1,1,3,1,1,3,3,3,1,1,3,3,3,1,1,3,3,3,1,1,3,1,1,3,1,1,3,3,3,1,1
%N A080426 a(1)=1, a(2)=3; all terms are either 1 or 3; each run of 3's is followed by a run of two 1's; and a(n) is the length of the n-th run of 3's.
%C A080426 It appears that the sequence can be calculated by any of the following three methods: (1) Start with 1 and repeatedly replace (simultaneously) all 1's with 1,3,1 and all 3's with 1,3,3,3,1. [Equivalently, trajectory of 1 under the morphism 1 -> 1,3,1; 3 -> 1,3,3,3,1. - _N. J. A. Sloane_, Nov 03 2019] (2) a(n)= A026490(2n). (3) Replace each 2 in A026465 (run lengths in Thue-Morse) with 3.
%C A080426 Length of n-th run of 1's in the Feigenbaum sequence A035263 = 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, .... - _Philippe Deléham_, Apr 18 2004
%C A080426 Another construction. Let S_0 = 1, and let S_n be obtained by applying the morphism 1 -> 3, 3 -> 113 to S_{n-1}. The sequence is the concatenation S_0, S_1, S_2, ... - D. R. Hofstadter, Oct 23 2014
%C A080426 a(n+1) is the number of times n appears in A003160. - _John Keith_, Dec 31 2020
%H A080426 Reinhard Zumkeller, <a href="/A080426/b080426.txt">Table of n, a(n) for n = 1..10000</a>
%H A080426 Jean-Paul Allouche, <a href="https://webusers.imj-prg.fr/~jean-paul.allouche/121-12221.pdf">On the morphism 1 -> 121, 2 -> 12221</a>, CNRS France, 2024. See pp. 5-6.
%H A080426 Jean-Paul Allouche, <a href="/A026465/a026465.pdf">On the morphism 1 -> 121, 2 -> 12221</a>, Preprint, 2024 [Local copy, with permission]
%H A080426 D. R. Hofstadter, <a href="/A075326/a075326_1.pdf">Anti-Fibonacci numbers</a>, Oct 23 2014.
%F A080426 a(1) = 1; for n>1, a(n) = A003156(n) - A003156(n-1). - _Philippe Deléham_, Apr 16 2004
%t A080426 Position[ Nest[ Flatten[# /. {0 -> {0, 2, 1}, 1 -> {0}, 2 -> {0}}]&, {0}, 8], 0] // Flatten // Differences // Prepend[#, 1]& (* _Jean-François Alcover_, Mar 14 2014, after _Philippe Deléham_ *)
%t A080426 nsteps=7;Flatten[SubstitutionSystem[{1->{3},3->{1,1,3}},{1},nsteps]] (* _Paolo Xausa_, Aug 12 2022, using D. R. Hofstadter's construction *)
%o A080426 (Haskell) -- following Deléham
%o A080426 import Data.List (group)
%o A080426 a080426 n = a080426_list !! n
%o A080426 a080426_list = map length $ filter ((== 1) . head) $ group a035263_list
%o A080426 -- _Reinhard Zumkeller_, Oct 27 2014
%o A080426 (PARI)
%o A080426 A080426(nmax) = my(a=[1], s=[[1, 3, 1], [], [1, 3, 3, 3, 1]]); while(length(a)<nmax, a=concat(vecextract(s,a))); a[1..nmax];
%o A080426 A080426(100) \\ _Paolo Xausa_, Sep 14 2022, using method (1) from comments
%o A080426 (Python)
%o A080426 def A080426(nmax):
%o A080426     a, s = "1", "".maketrans({"1":"131", "3":"13331"})
%o A080426     while len(a) < nmax: a = a.translate(s)
%o A080426     return list(map(int, a[:nmax]))
%o A080426 print(A080426(100)) # _Paolo Xausa_, Aug 30 2022, using method (1) from comments
%o A080426 (Python)
%o A080426 def A080426(n):
%o A080426     def bisection(f,kmin=0,kmax=1):
%o A080426         while f(kmax) > kmax: kmax <<= 1
%o A080426         kmin = kmax >> 1
%o A080426         while kmax-kmin > 1:
%o A080426             kmid = kmax+kmin>>1
%o A080426             if f(kmid) <= kmid:
%o A080426                 kmax = kmid
%o A080426             else:
%o A080426                 kmin = kmid
%o A080426         return kmax
%o A080426     def f(x):
%o A080426         c, s = x, bin(x)[2:]
%o A080426         l = len(s)
%o A080426         for i in range(l&1,l,2):
%o A080426             c -= int(s[i])+int('0'+s[:i],2)
%o A080426         return c
%o A080426     return bisection(lambda x:f(x)+n,n,n)-bisection(lambda x:f(x)+n-1,n-1,n-1)-1 # _Chai Wah Wu_, Jan 29 2025
%Y A080426 Cf. A026465, A026490, A035263, A003156, A328979, A003160.
%Y A080426 Arises in the analysis of A075326, A249031 and A249032.
%K A080426 nonn
%O A080426 1,2
%A A080426 _John W. Layman_, Feb 18 2003