cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A227928 Powers of 2 or of 3 in order as occurring in the two ways of parenthesizing the terms in A006895.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 09 2013

Keywords

Comments

Permutation of A006899, a(n) = A006899(n+k) for some k in {-1,0,1}.

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) .
		

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'