login
a(1)=1, a(n)=2*a(n-1) if n is odd, or a(n)=a(n/2)+1 if n is even.
4

%I #13 May 14 2015 20:00:59

%S 1,2,4,3,6,5,10,4,8,7,14,6,12,11,22,5,10,9,18,8,16,15,30,7,14,13,26,

%T 12,24,23,46,6,12,11,22,10,20,19,38,9,18,17,34,16,32,31,62,8,16,15,30,

%U 14,28,27,54,13,26,25,50,24,48,47,94,7,14,13,26,12,24,23,46,11,22,21,42,20

%N a(1)=1, a(n)=2*a(n-1) if n is odd, or a(n)=a(n/2)+1 if n is even.

%C b(1)=1, b(n)=2*b(n/2) if n is even, or b(n)=b(n-1)+1 if n is odd produces the sequence of natural numbers.

%C Seen as a triangle read by rows: T(1,1) = 1; T(n+1,2*k-1) = T(n,k)+1 and T(n+1,2*k) = 2*T(n,k)+2, 1 <= k <= 2^n. - _Reinhard Zumkeller_, May 13 2015

%H Reinhard Zumkeller, <a href="/A082560/b082560.txt">Rows n = 1..13 of triangle, flattened</a>

%F if n is in A010737 : a(n)=n-1

%e . 1: 1

%e . 2: 2 4

%e . 3: 3 6 5 10

%e . 4: 4 8 7 14 6 12 11 22

%e . 5: 5 10 9 18 8 16 15 30 7 14 13 26 12 24 23 46

%o (PARI) a(n)=if(n<2,1,if(n%2,2*a(n-1),1+a(n/2)))

%o (Haskell)

%o a082560 n k = a082560_tabf !! (n-1) !! (k-1)

%o a082560_row n = a082560_tabf !! (n-1)

%o a082560_tabf = iterate (concatMap (\x -> [x + 1, 2 * x + 2])) [1]

%o a082560_list = concat a082560_tabf

%o -- _Reinhard Zumkeller_, May 13 2015

%Y Cf. A000079 (row lengths), A033484 (right edges), A166060 (row sums), A232642 (duplicates removed).

%K nonn,tabf,look

%O 1,2

%A _Benoit Cloitre_, May 04 2003