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 A274575 #44 Apr 21 2024 13:24:08 %S A274575 0,-1,1,-2,0,0,2,-3,-1,-1,1,-1,1,1,3,-4,-2,-2,0,-2,0,0,2,-2,0,0,2,0,2, %T A274575 2,4,-5,-3,-3,-1,-3,-1,-1,1,-3,-1,-1,1,-1,1,1,3,-3,-1,-1,1,-1,1,1,3, %U A274575 -1,1,1,3,1,3,3,5,-6,-4,-4,-2,-4,-2,-2,0,-4,-2,-2,0,-2,0,0,2,-4,-2,-2,0,-2,0,0,2,-2,0,0,2,0,2,2,4,-4,-2,-2,0,-2,0,0,2,-2,0,0,2,0,2,2,4,-2,0,0,2,0,2,2,4,0 %N A274575 For m=1,2,3,... write all the 2^m binary vectors of length m in increasing order, and replace each vector with (number of 1's) - (number of 0's). Start with an initial 0 for the empty vector. %C A274575 This is the sequence of To-And-Fro positions: Positions of all backward-forward combinations in lexicographical order when assigning -1 to a backward move and +1 to a forward move and starting at 0. %C A274575 -a(n) are the slopes of the different segments, from left to right, of the successive steps in the construction of the Takagi (a.k.a. Blancmange) function. - _Javier Múgica_, Dec 31 2017 %H A274575 John Tyler Rascoe, <a href="/A274575/b274575.txt">Table of n, a(n) for n = 0..8190</a> %F A274575 a(2*n + 1) = a(n) - 1; a(2*n + 2) = a(n) + 1. %e A274575 Terms a(3) to a(6) correspond to the binary vectors 00, 01, 10, 11, which get replaced by -2, 0, 0, 2, respectively. Terms a(7) to a(14) correspond to the binary vectors 000, 001, ..., 111 which get replaced by -3, -1, ..., 3. a(0) = 0 %e A274575 a(1) = a('backward') = -1 %e A274575 a(2) = a('forward') = +1 %e A274575 a(3) = a('backward and backward') = -2 %e A274575 a(4) = a('backward and forward') = 0 %e A274575 a(5) = a('forward and backward') = 0 %e A274575 a(6) = a('forward and forward') = +2 %e A274575 a(7) = a('backward, backward and backward') = -3 %e A274575 a(8) = a('backward, backward and forward') = -1 %e A274575 Arranged as a tree read by rows: %e A274575 ______0______ %e A274575 / \ %e A274575 __-1__ __1__ %e A274575 / \ / \ %e A274575 -2 0 0 2 %e A274575 / \ / \ / \ / \ %e A274575 -3 -1 -1 1 -1 1 1 3 %e A274575 . - _John Tyler Rascoe_, Sep 23 2023 %o A274575 (BASIC) %o A274575 Dim a(2*k+2) %o A274575 a(0) = 0 %o A274575 For n = 0 To k %o A274575 a(2 * n + 1) = a(n) - 1 %o A274575 a(2 * n + 2) = a(n) + 1 %o A274575 Next n %o A274575 (Python) %o A274575 def A274575_list(nmax): %o A274575 A = [0] %o A274575 for n in range(0,nmax): %o A274575 A.append(A[n//2]-(-1)**n) %o A274575 return(A) %o A274575 print(A274575_list(119)) # _John Tyler Rascoe_, Sep 23 2023 %Y A274575 Cf. A037861. %K A274575 sign,easy %O A274575 0,4 %A A274575 _Hans G. Oberlack_, Jun 28 2016 %E A274575 Edited by _N. J. A. Sloane_, Jul 27 2016