The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A044903 Base-2 run lengths alternate: odd, even, odd, ... 0
 1, 4, 7, 9, 16, 28, 31, 33, 36, 39, 57, 64, 73, 112, 124, 127, 129, 132, 135, 144, 156, 159, 225, 228, 231, 249, 256, 265, 289, 292, 295, 313, 448, 457, 496, 508, 511, 513, 516, 519, 528, 540, 543, 576, 585, 624, 636, 639, 897, 900 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS From Emeric Deutsch, Jan 27 2018: (Start) Also the indices of the compositions whose parts alternate: odd, even, odd, ... . For the definition of the index of a composition see A298644. For example, 57 is in the sequence since its binary form is 111001 and the composition [3,2,1] has parts: odd, even, odd. 59 is not in the sequence since its binary form is 111011 and the composition [3,1,2] has parts: odd, odd, even. The command c(n) from the Maple program yields the composition having index n. (End) LINKS Table of n, a(n) for n=1..50. MAPLE Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 900 do if `and`(type(c(n)[1], odd) = true, type(product(c(n)[j]-c(n)[j+1], j = 1 .. nops(c(n))-1), odd)) then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to W. Edwin Clark. # Emeric Deutsch, Jan 27 2018 PROG (Python) from itertools import groupby def ok(n): return all(len(list(g))%2 != i%2 for i, (k, g) in enumerate(groupby(bin(n)[2:]))) print([i for i in range(1, 901) if ok(i)]) # Michael S. Branicky, Jan 04 2021 CROSSREFS Cf. A298644, A101211. Sequence in context: A271253 A271542 A010424 * A359016 A281144 A103073 Adjacent sequences: A044900 A044901 A044902 * A044904 A044905 A044906 KEYWORD nonn,base AUTHOR Clark Kimberling STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified February 28 21:38 EST 2024. Contains 370400 sequences. (Running on oeis4.)