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.

A227862 A boustrophedon triangle.

Original entry on oeis.org

1, 1, 2, 4, 3, 1, 1, 5, 8, 9, 24, 23, 18, 10, 1, 1, 25, 48, 66, 76, 77, 294, 293, 268, 220, 154, 78, 1, 1, 295, 588, 856, 1076, 1230, 1308, 1309, 6664, 6663, 6368, 5780, 4924, 3848, 2618, 1310, 1, 1, 6665, 13328, 19696, 25476, 30400, 34248, 36866, 38176, 38177
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 01 2013

Keywords

Comments

T(n, n * (n mod 2)) = A000667(n).

Examples

			First nine rows:
.  0:                                    1
.  1:                               1   ->  2
.  2:                           4   <-   3  <-  1
.  3:                       1 ->    5 ->   8   ->   9
.  4:                   24  <-  23  <-  18  <-  10  <-  1
.  5:              1  ->  25  ->  48  ->   66 ->   76  ->  77
.  6:          294 <-  293 <-  268 <-  220 <-  154  <-  78   <-  1
.  7:      1  ->  295 ->  588 ->  856 -> 1076 -> 1230 -> 1308 -> 1309
.  8:  6664 <- 6663 <- 6368 <- 5780 <- 4924 <- 3848 <- 2618 <- 1310  <- 1 .
		

Crossrefs

Cf. A008280.

Programs

  • Haskell
    a227862 n k = a227862_tabl !! n !! k
    a227862_row n = a227862_tabl !! n
    a227862_tabl = map snd $ iterate ox (False, [1]) where
       ox (turn, xs) = (not turn, if turn then reverse ys else ys)
          where ys = scanl (+) 1 (if turn then reverse xs else xs)
  • Mathematica
    T[0, 0] = 1; T[n_?OddQ, 0] = 1; T[n_?EvenQ, n_] = 1; T[n_, k_] /; 0 <= k <= n := T[n, k] = If[OddQ[n], T[n, k - 1] + T[n - 1, k - 1], T[n, k + 1] + T[n - 1, k]]; T[, ] = 0;
    Table[T[n, k], {n, 0, 9}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 23 2019 *)