OFFSET
1,2
COMMENTS
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.
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
LINKS
Reinhard Zumkeller, Rows n = 1..13 of triangle, flattened
FORMULA
if n is in A010737 : a(n)=n-1
EXAMPLE
. 1: 1
. 2: 2 4
. 3: 3 6 5 10
. 4: 4 8 7 14 6 12 11 22
. 5: 5 10 9 18 8 16 15 30 7 14 13 26 12 24 23 46
PROG
(PARI) a(n)=if(n<2, 1, if(n%2, 2*a(n-1), 1+a(n/2)))
(Haskell)
a082560 n k = a082560_tabf !! (n-1) !! (k-1)
a082560_row n = a082560_tabf !! (n-1)
a082560_tabf = iterate (concatMap (\x -> [x + 1, 2 * x + 2])) [1]
a082560_list = concat a082560_tabf
-- Reinhard Zumkeller, May 13 2015
CROSSREFS
KEYWORD
AUTHOR
Benoit Cloitre, May 04 2003
STATUS
approved