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, -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
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
Links
- John Tyler Rascoe, Table of n, a(n) for n = 0..8190
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
Comments