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.

A306216 Successive concatenation of the current sequence with the first differences of the sequence, a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 1, -1, 1, -1, 0, -1, 0, -1, 1, -1, 1, -1, 1, -1, 1, -1, 2, -2, 2, -2, 0, -1, 0, -1, 1, -1, 1, -1, 1, -1, 1, -1, 2, -2, 2, -2, 1, -1, 1, -1, 2, -2, 2, -2, 2, -2, 2, -2, 3, -4, 4, -4, 0, -1, 0, -1, 1, -1, 1, -1, 1, -1
Offset: 1

Views

Author

Peter Kagey, Jan 29 2019

Keywords

Comments

n | generation | first differences
--+------------------------+-------------------
1 | [1,1] | [0]
2 | [1,1,0] | [0,-1]
3 | [1,1,0,0,-1] | [0,-1,0,-1]
4 | [1,1,0,0,-1,0,-1,0,-1] | [0,-1,0,-1,1,-1,1,-1]

Crossrefs

Programs

  • Haskell
    a306216_list = 1 : 1 : concat (Data.List.unfoldr nextGeneration [1,1]) where
      nextGeneration l = Just (diff l, l ++ diff l)
      diff xs =  zipWith subtract xs (tail xs)
  • Mathematica
    Nest[Join[#, Differences@ #] &, {1, 1}, 7] (* Michael De Vlieger, Jan 29 2019 *)
  • Ruby
    generations = 10
    (1...generations).reduce([1,1]) do |s, _|
      s += s.each_cons(2).map { |a, b| b - a }
    end