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.

A075825 a(0) = 1, a(1) = 2; for n>0, a(2n) = |a(n)-a(n-1)|, a(2n+1) = a(n)+a(n-1).

Original entry on oeis.org

1, 2, 1, 3, 1, 3, 2, 4, 2, 4, 2, 4, 1, 5, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 3, 5, 4, 6, 3, 7, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 3, 9, 2, 8, 1, 9, 2, 10, 3, 9, 4, 10, 3, 11, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4
Offset: 0

Views

Author

John W. Layman, Oct 14 2002

Keywords

Comments

For 2*2^k-2 <= n <= 3*2^k-1, a(n) alternates: 2^floor(k/2) if n is even, A029744(k+2) if n is odd. - Robert Israel, Nov 08 2016

Crossrefs

Cf. A029744.

Programs

  • Maple
    A[0]:= 1: A[1]:= 2:
    for n from 1 to 100 do
      A[2*n]:= abs(A[n]-A[n-1]);
      A[2*n+1]:= A[n]+A[n-1];
    od:
    seq(A[n],n=0..201); # Robert Israel, Nov 08 2016
  • Mathematica
    a[0]=1; a[1]=2; a[n_]:=If[EvenQ[n],Abs[a[n/2]-a[n/2-1]],a[(n-1)/2]+a[(n-3)/2]]; Array[a,95,0] (* Stefano Spezia, Apr 04 2024 *)