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.

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.

Original entry on oeis.org

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
Offset: 0

Views

Author

Hans G. Oberlack, Jun 28 2016

Keywords

Comments

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.
-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

Examples

			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
Arranged as a tree read by rows:
               ______0______
              /             \
          __-1__           __1__
         /      \         /     \
       -2        0       0       2
       / \      / \     / \     / \
     -3  -1   -1   1  -1   1   1   3
. - _John Tyler Rascoe_, Sep 23 2023
		

Crossrefs

Cf. A037861.

Programs

  • 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
    
  • Python
    def A274575_list(nmax):
        A = [0]
        for n in range(0,nmax):
            A.append(A[n//2]-(-1)**n)
        return(A)
    print(A274575_list(119)) # John Tyler Rascoe, Sep 23 2023

Formula

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

Extensions

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