[go: up one dir, main page]

login
A082560
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
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, 12, 24, 23, 46, 6, 12, 11, 22, 10, 20, 19, 38, 9, 18, 17, 34, 16, 32, 31, 62, 8, 16, 15, 30, 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
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
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
Cf. A000079 (row lengths), A033484 (right edges), A166060 (row sums), A232642 (duplicates removed).
Sequence in context: A231334 A253609 A300002 * A191598 A338221 A283312
KEYWORD
nonn,tabf,look
AUTHOR
Benoit Cloitre, May 04 2003
STATUS
approved