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.
%I A371594 #29 Mar 10 2025 08:53:01 %S A371594 1,3,4,6,8,11,13,14,16,19,20,22,25,27,29,30,32,35,36,38,40,43,45,46, %T A371594 49,51,52,54,57,59,61,62,64,67,68,70,72,75,77,78,80,83,84,86,89,91,93, %U A371594 94,97,99,100,102,104,107,109,110,113,115,116,118,121,123,125 %N A371594 Starting positions of runs in the paperfolding sequence A014707. %C A371594 A "run" is a maximal block of consecutive identical terms. The paperfolding sequence A014707 is more usually indexed starting at position 1, not 0, and this choice is reflected in the sequence (cf. A034947). %H A371594 M. Bunder, B. Bates, and S. Arnold, <a href="https://doi.org/10.1017/S0004972724000169">The summed paperfolding sequence</a>, Bull. Aust. Math. Soc. 110 (2024), 189-198. %H A371594 Kevin Ryde, <a href="http://user42.tuxfamily.org/dragon/index.html">Iterations of the Dragon Curve</a>, see index "TurnRunStart" with a(n) = TurnRunStart(n-1). %H A371594 Jeffrey Shallit, <a href="/A371594/a371594.pdf">Automaton for A371594</a>. %F A371594 The automaton accompanying this entry accepts exactly the base-2 representations of the terms of this sequence. %F A371594 a(n) = 2*n-1 - ((n + A014707(n-2)) mod 2), for n >= 2. - _Kevin Ryde_, Mar 28 2024 %e A371594 The first few terms of A014707 are 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, and runs begin at positions 1, 3, 4, 6, 8, 11, 13, 14, ... %t A371594 Abs@ SplitBy[Array[# KroneckerSymbol[-1, #] &, 120], Sign][[All, 1]] (* _Michael De Vlieger_, Mar 28 2024 *) %o A371594 (Python) # DFA transition function and simulation %o A371594 d = { (0,0):0, (0,1):1, (1,0):2, (1,1):3, (2,0):4, (2,1):5, %o A371594 (3,0):6, (3,1):7, (4,0):4, (4,1):5, (5,0):2, (5,1):3, %o A371594 (6,0):0, (6,1):1, (7,0):6, (7,1):7 } %o A371594 def ok(n): %o A371594 q, w = 0, map(int, bin(n)[2:]) %o A371594 for c in w: q = d[q, c] %o A371594 return q in {1, 3, 4, 6} %o A371594 print([k for k in range(126) if ok(k)]) # _Michael S. Branicky_, Mar 28 2024 %o A371594 (Python) # using formula and function in A014707 %o A371594 def a(n): return 2*n-1 - (n + A014707(n-2))%2 if n>=2 else 1 %o A371594 print([a(n) for n in range(1, 64)]) # _Michael S. Branicky_, Mar 29 2024 %o A371594 (PARI) a(n) = if(n==1,1, n--; 2*n + bitxor(bittest(n,0), bittest(n,valuation(n,2)+1))); \\ _Kevin Ryde_, Apr 06 2024 %Y A371594 Cf. A014707, A034947. %K A371594 nonn,easy %O A371594 1,2 %A A371594 _Jeffrey Shallit_, Mar 28 2024