

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.


0



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,4


COMMENTS

This is the sequence of ToAndFro positions: Positions of all backwardforward combinations in lexicographical order when assigning 1 to a backward move and +1 to a forward move and starting at 0.
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


LINKS

Table of n, a(n) for n=0..119.


FORMULA

a(2*n + 1) = a(n)  1; a(2*n + 2) = a(n) + 1.


EXAMPLE

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
a(1) = a('backward') = 1
a(2) = a('forward') = +1
a(3) = a('backward and backward') = 2
a(4) = a('backward and forward') = 0
a(5) = a('forward and backward') = 0
a(6) = a('forward and forward') = +2
a(7) = a('backward, backward and backward') = 3
a(8) = a('backward, backward and forward') = 1


PROG

Basic
Dim a(2*k+2)
a(0) = 0
For n = 0 To k
a(2 * n + 1) = a(n)  1
a(2 * n + 2) = a(n) + 1
Next n


CROSSREFS

Cf. A037861.
Sequence in context: A323886 A174739 A280542 * A203994 A285725 A215889
Adjacent sequences: A274572 A274573 A274574 * A274576 A274577 A274578


KEYWORD

sign,easy


AUTHOR

Hans G. Oberlack, Jun 28 2016


EXTENSIONS

Edited by N. J. A. Sloane, Jul 27 2016


STATUS

approved



