%I M0158 #12 Oct 09 2013 16:32:36
%S 1,2,1,3,6,2,16,9,23,58,6,128,109,147,512,70,954,1233,815,4096,1650,
%T 6542,13141,3243,32768,23038,42498,131072,3577,258567,272874,251414,
%U 1048576,294333,1802819,2980150,1214154,8388608,4746145,12031071,31015650,2538782
%N Parenthesized one way gives the powers of 2: (1), (2), (1+3), ..., another way the powers of 3: (1), (2+1), (3+6), ....
%C Powers of 2 need 1 term or 2 terms parenthesized, whereas powers of 3 need 2 or 3 terms parenthesized, when 3 then the middle term is a power of 2. See A227928. - _Reinhard Zumkeller_, Oct 09 2013
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Reinhard Zumkeller, <a href="/A006895/b006895.txt">Table of n, a(n) for n = 0..1000</a>
%e . a(0) = _^0
%e . a(1) = 2^1
%e . a(1) + a(2) = 2 + 1 = 3^1
%e . a(2) + a(3) = 1 + 3 = 4 = 2^2
%e . a(3) + a(4) = 3 + 6 = 9 = 3^2
%e . a(4) + a(5) = 6 + 2 = 8 = 2^3
%e . a(6) = 16 = 2^4
%e . a(5) + a(6) + a(7) = 2 + 16 + 9 = 27 = 3^3
%e . a(7) + a(8) = 9 + 23 = 32 = 2^5
%e . a(8) + a(9) = 23 + 58 = 81 = 3^4
%e . a(9) + a(10) = 58 + 6 = 64 = 2^6
%e . a(11) = 128 = 2^7
%e . a(10) + a(11) + a(12) = 6 + 128 + 109 = 243 = 3^5
%e . a(12) + a(13) = 109 + 147 = 256 = 2^8
%e . a(14) = 512 = 2^9
%e . a(13) + a(14) + a(15) = 147 + 512 + 70 = 3^6 = 729 .
%o (Haskell)
%o a006895 n = a006895_list !! n
%o a006895_list = 1 : f 0 0 (tail a000079_list) (tail a000244_list) where
%o f x y us'@(u:us) vs'@(v:vs)
%o | x > 0 = (u - x) : f 0 (u - x + y) us vs'
%o | y > v - u = (v - y) : f (v + x - y) 0 us' vs
%o | otherwise = u : f 0 (u + y) us vs'
%o -- _Reinhard Zumkeller_, Oct 09 2013
%Y Cf. A000079, A000244, A006899, A108906, A085239.
%K nonn,nice
%O 0,2
%A _N. J. A. Sloane_, K. S. Brown [ kevin2003(AT)delphi.com ]