A227928 Powers of 2 or of 3 in order as occurring in the two ways of parenthesizing the terms in A006895.
1, 2, 3, 4, 9, 8, 16, 27, 32, 81, 64, 128, 243, 256, 512, 729, 1024, 2187, 2048, 4096, 6561, 8192, 19683, 16384, 32768, 59049, 65536, 131072, 177147, 262144, 531441, 524288, 1048576, 1594323, 2097152, 4782969, 4194304, 8388608, 14348907, 16777216, 43046721
Offset: 1
Keywords
Examples
. n | a(n) let x denote A006895 . ----+------ . 1 | 1 = x(0) . 2 | 2 = x(1) . 3 | 3 = 2 + 1 = x(1) + x(2) . 4 | 4 = 1 + 3 = x(2) + x(3) . 5 | 9 = 3 + 6 = x(3) + x(4) . 6 | 8 = 6 + 2 = x(4) + x(5) . 7 | 16 = x(6) . 8 | 27 = 2 + 16 + 9 = x(5) + x(6) + x(7) . 9 | 32 = 9 + 23 = x(7) + x(8) . 10 | 81 = 23 + 58 = x(8) + x(9) . 11 | 64 = 58 + 6 = x(9) + x(10) . 12 | 128 = x(11) . 13 | 243 = 6 + 128 + 109 = x(10) + x(11) + x(12) . 14 | 256 = 109 + 147 = x(12) + x(13) . 15 | 512 = x(14) . 16 | 729 = 147 + 512 + 70 = x(13) + x(14) + x(15) .
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
Programs
-
Haskell
a227928 n = a227928_list !! (n-1) a227928_list = 1 : f 0 0 (tail a000079_list) (tail a000244_list) where f x y us'@(u:us) vs'@(v:vs) | x > 0 = u : f 0 (u - x + y) us vs' | y > v - u = v : f (v + x - y) 0 us' vs | otherwise = u : f 0 (u + y) us vs'
Comments