A290259 Triangle read by rows: row n (>=1) contains in increasing order the integers for which the binary representation has length n, the first run of 1's has odd length, and all the other runs of 1's have even length.
1, 2, 4, 7, 8, 11, 14, 16, 19, 22, 28, 31, 32, 35, 38, 44, 47, 56, 59, 62, 64, 67, 70, 76, 79, 88, 91, 94, 112, 115, 118, 124, 127, 128, 131, 134, 140, 143, 152, 155, 158, 176, 179, 182, 188, 191, 224, 227, 230, 236, 239, 248, 251, 254, 256, 259, 262, 268, 271, 280, 283, 286, 304, 307, 310, 316, 319, 352, 355, 358, 364, 367, 376, 379, 382, 448, 451, 454, 460, 463, 472, 475, 478, 496, 499, 502, 508, 511
Offset: 1
Examples
115 is in the sequence; indeed, its binary representation, namely 1110011, has first run of 1's of odd length and the other runs of 1's have even length. Triangle begins: 1; 2; 4, 7; 8, 11, 14; 16, 19, 22, 28, 31; 32, 35, 38, 44, 47, 56, 59, 62; ...
Programs
-
Maple
A[1] := {1}; A[2] := {2}; for n from 3 to 10 do A[n] := `union`(map(proc (x) 2*x end proc, A[n-1]), map(proc (x) 4*x+3 end proc, A[n-2])) end do; # yields sequence in triangular form
-
Mathematica
nmax = 10; A[1] = {1}; A[2] = {2}; For[n = 3, n <= nmax, n++, A[n] = Union[2 A[n-1], 4 A[n-2] + 3]]; Table[A[n], {n, 1, nmax}] // Flatten (* Jean-François Alcover, Aug 26 2024, after Maple program *)
Formula
The entries in row n (n>=3) are (i) 2x, where x is in row n-1, and (ii) 4y + 3, where y is in row n-2. The Maple program is based on this.
Comments