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.

A213369 The twisted Stern sequence: a(0) = 0, a(1) = 1 and a(2n) = -a(n), a(2n + 1) = -a(n)-a(n + 1) for n>=1.

Original entry on oeis.org

0, 1, -1, 0, 1, 1, 0, -1, -1, -2, -1, -1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 2, 1, 1, 0, -1, -1, -2, -1, -3, -2, -3, -1, -4, -3, -5, -2, -5, -3, -4, -1, -3, -2, -3, -1, -2, -1, -1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7
Offset: 0

Views

Author

N. J. A. Sloane, Jun 13 2012

Keywords

Crossrefs

Cf. A002487. Absolute values give A020944.

Programs

  • Mathematica
    a[0]=0; a[1]=1; a[n_] := a[n] = If[EvenQ[n], -a[n/2], -a[(n-1)/2]-a[(n+1)/2 ]]; Table[a[n], {n, 0, 77}] (* Jean-François Alcover, Oct 02 2018 *)
  • Maxima
    a[0]:0$ a[1]:1$ a[n]:=-a[floor(n/2)]-(1-(-1)^n)*a[floor((n-1)/2)+1]/2$ makelist(a[n],n,0,77); /* Bruno Berselli, Jun 15 2012 */

Formula

a(n) = A287729(n) - A287730(n) for n > 0. - Michel Marcus & I. V. Serov, May 28 2019