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.

A209281 Start with first run [0,1] then, for n >= 2, the n-th run has length 2^n and is the concatenation of [a(1),a(2),...,a(2^n/2)] and [n-a(1),n-a(2),...,n-a(2^n/2)].

Original entry on oeis.org

0, 1, 2, 1, 3, 2, 1, 2, 4, 3, 2, 3, 1, 2, 3, 2, 5, 4, 3, 4, 2, 3, 4, 3, 1, 2, 3, 2, 4, 3, 2, 3, 6, 5, 4, 5, 3, 4, 5, 4, 2, 3, 4, 3, 5, 4, 3, 4, 1, 2, 3, 2, 4, 3, 2, 3, 5, 4, 3, 4, 2, 3, 4, 3, 7, 6, 5, 6, 4, 5, 6, 5, 3, 4, 5, 4, 6, 5, 4, 5, 2, 3, 4, 3, 5, 4, 3
Offset: 1

Views

Author

Benoit Cloitre, Jan 16 2013

Keywords

Comments

Also the sum of the odd bisection (odd-indexed parts) of the (n-1)-th composition in standard order, where the k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. Note that this sequence counts {} as composition number 1 (instead of the usual 0). For example, composition number 741 in standard order is (2,1,1,3,2,1), with odd bisection (2,1,2), so a(742) = 2 + 1 + 2 = 5. - Gus Wiseman, Aug 24 2021

Examples

			[0,1] -> [0,1] U [2-0,2-1] =
[0,1,2,1] -> [0,1,2,1] U [3-0,3-1,3-2,3-1] =
[0,1,2,1,3,2,1,2] etc.
From _Gus Wiseman_, Aug 08 2021: (Start)
As a triangle without the initial 0, row-lengths A000079:
  1
  2 1
  3 2 1 2
  4 3 2 3 1 2 3 2
  5 4 3 4 2 3 4 3 1 2 3 2 4 3 2 3
  6 5 4 5 3 4 5 4 2 3 4 3 5 4 3 4 1 2 3 2 4 3 2 3 5 4 3 4 2 3 4 3
(End)
		

Crossrefs

Cf. A010060 (Thue-Morse), A103204 (indices of 1's).
Cf. A029837 (binary order), A000120 (binary weight), A006068 (inverse Gray), A272020 (bit positions).
Cf. A089215.
As a triangle: A000079 (row lengths), A001792 (row sums).
Other composition part sums: A124754. A346633.
Also the sum of row A346702(n-1) of A066099.
Cf. A346697 (on prime indices).

Programs

  • Mathematica
    Table[Total[First/@Partition[Append[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse,0],2]],{n,0,100}] (* Gus Wiseman, Aug 08 2021 *)
  • PARI
    /* compute 2^15 terms */ v=[0,1];for(n=2,15,v=concat(v,vector(2^n/2,i,n-v[i]));a(n)=v[n];)
    
  • PARI
    a(n) = n--; my(s=1,ns); while((ns=n>>s), n=bitxor(n,ns); s<<=1); hammingweight(n); \\ Kevin Ryde, May 14 2022

Formula

Let T(n)=A010060(n) then for n>=1 a(2n)=a(n)+1-T(n-1) and a(2n+1)=a(n+1)+T(n).
For n>=2 a(n) = a(ceiling(n/2))+T(n-1) hence:
a(n) = Sum_{k=0..ceiling(log(n-1)/log(2))} T(floor((n-1)/2^k)).
For k>=0 a(3*2^k+1)=1 (more precisely a(n)=1 iff n is in A103204), a(2^k+1)=k+1, a(5*2^k+1)=2, a(7*2^k+1)=k+2 etc.
From Gus Wiseman, Aug 18 2021: (Start)
a(n + 1) = (A029837(n) + A124754(n))/2.
a(n + 1) = A029837(n) - A346633(n).
a(n + 1) = A346633(n) - A124754(n).
a(n + 1) = A029837(A346702(n)).
(End)
From Kevin Ryde, May 14 2022: (Start)
a(n) = A000120(A006068(n-1)), binary weight of inverse binary Gray code.
a(n) = Sum_{k=1..A000120(n-1)} (-1)^(k-1) * A272020(n-1,k), alternating sum of 1-bit positions.
a(n) = A089215(n) - 1.
(End)