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.

Showing 1-5 of 5 results.

A003815 a(0) = 0, a(n) = a(n-1) XOR n.

Original entry on oeis.org

0, 1, 3, 0, 4, 1, 7, 0, 8, 1, 11, 0, 12, 1, 15, 0, 16, 1, 19, 0, 20, 1, 23, 0, 24, 1, 27, 0, 28, 1, 31, 0, 32, 1, 35, 0, 36, 1, 39, 0, 40, 1, 43, 0, 44, 1, 47, 0, 48, 1, 51, 0, 52, 1, 55, 0, 56, 1, 59, 0, 60, 1, 63, 0, 64, 1, 67, 0
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A003816.
Cf. A077140, A145768. - M. F. Hasler, Oct 20 2008

Programs

  • Mathematica
    an = 0; Reap[ For[i = 0, i <= 100, i++, an = BitXor[an, i]; Sow[an]]][[2, 1]] (* Jean-François Alcover, Oct 11 2013, translated from PARI *)
    CoefficientList[Series[x (1 + 3 x - x^2 + x^3)/((1 - x^4) (1 - x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Oct 12 2013 *)
    nxt[{n_,a_}]:={n+1,BitXor[n+1,a]}; NestList[nxt,{0,0},70][[All,2]] (* Harvey P. Dale, Mar 10 2019 *)
    {#,1,#+1,0}[[1+Mod[#,4]]]&/@Range[0,100] (* Federico Provvedi, May 10 2021 *)
  • PARI
    print1(an=0); for( i=1,100, print1(",",an=bitxor(an,i))) \\ M. F. Hasler, Oct 20 2008

Formula

a(n) = n + (-1)^n*a(n-1). - Vladeta Jovovic, Mar 13 2003
a(0)=0, a(4n+1)=1, a(4n+2)=4n+3, a(4n+3)=0, a(4n+4)=4n+4, n >= 0.
a(n) = f(n,0) with f(n,x) = x if n=0, otherwise f(n-1,x+n) if x is even, otherwise f(n-1,x-n). - Reinhard Zumkeller, Oct 09 2007
a(n) = abs(A077140(n)) for n > 0. - Reinhard Zumkeller, Oct 09 2007
G.f.: x*(1+3*x-x^2+x^3)/((1-x^4)*(1-x^2)). - Vincenzo Librandi, Oct 12 2013
a(n) = (1 + n + n*(-1)^n + (-1)^floor((n-1)/2))/2. - Wesley Ivan Hurt, May 08 2021

A309214 a(0)=0; thereafter a(n) = a(n-1)+n if a(n-1) even, otherwise a(n) = a(n-1)-n.

Original entry on oeis.org

0, 1, -1, -4, 0, 5, -1, -8, 0, 9, -1, -12, 0, 13, -1, -16, 0, 17, -1, -20, 0, 21, -1, -24, 0, 25, -1, -28, 0, 29, -1, -32, 0, 33, -1, -36, 0, 37, -1, -40, 0, 41, -1, -44, 0, 45, -1, -48, 0, 49, -1, -52, 0, 53, -1, -56, 0, 57, -1, -60, 0, 61, -1, -64, 0, 65, -1, -68, 0, 69, -1, -72, 0, 73, -1
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2019

Keywords

Comments

A003816 and A309215 have the same terms except for signs.

Crossrefs

Programs

  • Maple
    t:=0;
    a:=[t]; M:=100;
    for i from 1 to M do
    if (t mod 2) = 0 then t:=t+i else t:=t-i; fi;
    a:=[op(a),t]; od:
    a;
  • PARI
    concat(0, Vec(x*(1 - 2*x - x^2) / ((1 - x)*(1 + x^2)^2) + O(x^80))) \\ Colin Barker, Aug 13 2019

Formula

a(4t)=0, a(4t+1)=4t+1, a(4t+2)=-1, a(4t+3)=-(4t+4).
From Colin Barker, Aug 13 2019: (Start)
G.f.: x*(1 - 2*x - x^2) / ((1 - x)*(1 + x^2)^2).
a(n) = a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) + a(n-5) for n>4.
a(n) = (-2 + (1+i)*(-i)^n + (1-i)*i^n + 2*i*((-i)^n-i^n)*n) / 4 where i=sqrt(-1).
(End)
E.g.f.: (1/2)*((1+2*x)*cos(x)-cosh(x)+sin(x)-sinh(x)). - Stefano Spezia, Aug 13 2019 after Colin Barker

A309215 a(0)=0; thereafter a(n) = a(n-1)+n if a(n-1) odd, otherwise a(n) = a(n-1)-n.

Original entry on oeis.org

0, -1, 1, 4, 0, -5, 1, 8, 0, -9, 1, 12, 0, -13, 1, 16, 0, -17, 1, 20, 0, -21, 1, 24, 0, -25, 1, 28, 0, -29, 1, 32, 0, -33, 1, 36, 0, -37, 1, 40, 0, -41, 1, 44, 0, -45, 1, 48, 0, -49, 1, 52, 0, -53, 1, 56, 0, -57, 1, 60, 0, -61, 1, 64, 0, -65, 1, 68, 0, -69, 1, 72, 0, -73, 1, 76, 0, -77
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2019

Keywords

Comments

A003816 and A309214 have the same terms except for signs.

Crossrefs

Programs

  • Maple
    t:=0;
    a:=[t]; M:=100;
    for i from 1 to M do
    if (t mod 2) = 1 then t:=t+i else t:=t-i; fi;
    a:=[op(a),t]; od:
    a;
  • Mathematica
    nxt[{n_,a_}]:={n+1,If[OddQ[a],a+n+1,a-n-1]}; NestList[nxt,{0,0},80][[All,2]] (* Harvey P. Dale, Sep 26 2021 *)
  • PARI
    concat(0, Vec(-x*(1 - 2*x - x^2) / ((1 - x)*(1 + x^2)^2) + O(x^40))) \\ Colin Barker, Aug 13 2019

Formula

a(4t)=0, a(4t+1)=-(4t+1), a(4t+2)=1, a(4t+3)=4t+4.
From Colin Barker, Aug 13 2019: (Start)
G.f.: -x*(1 - 2*x - x^2) / ((1 - x)*(1 + x^2)^2).
a(n) = a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) + a(n-5) for n>4.
a(n) = 1/2 - (1/4 - i/4)*((-i)^n+i^(1+n)) - (1/2)*i*((-i)^n-i^n)*(1+n) where i=sqrt(-1).
(End)

A309216 a(0)=0; thereafter a(n) = a(n-1)+n if the (n-1)st digit of the sequence is even, otherwise a(n) = a(n-1)-n.

Original entry on oeis.org

0, 1, -1, -4, 0, 5, -1, -8, 0, 9, -1, -12, -24, -11, 3, 18, 2, -15, -33, -52, -32, -11, -33, -56, -80, -105, -131, -104, -132, -103, -133, -164, -196, -229, -263, -228, -192, -155, -193, -154, -194, -235, -277, -320, -364, -319, -273, -320, -368, -319, -369, -318, -370, -423, -477, -532
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2019

Keywords

Comments

The absolute values of the digits are 0, 1, 1, 4, 0, 5, 1, 8, 0, 9, 1, 1, 2, 2, 4, 1, 1, 3, 1, 8, 2, 1, 5, 3, 3, 5, 2, ... (Of course the signs can be ignored when looking at the parity of the digits.)

Crossrefs

Programs

  • Maple
    t:=0;
    a:=[0]; b:=[]; M:=100;
    for i from 1 to M do
    v1:=convert(abs(t),base,10); L:=nops(v1);
    v2:=[seq(v1[L-i+1],i=1..L)];
    b:=[op(b),op(v2)];
    if (b[i] mod 2) = 0 then t:=t+i else t:=t-i; fi;
    a:=[op(a),t];
    od:
    a;

A309217 The sequence is {a(n), n>=0}, the concatenation of the binary expansions of the absolute values |a(n)| is {b(n), n>=0}; start with a(0)=0; thereafter a(n) = a(n-1)+n if b(n-1)=0, otherwise a(n) = a(n-1)-n.

Original entry on oeis.org

0, 1, -1, -4, -8, -3, 3, -4, 4, 13, 23, 12, 0, -13, -27, -42, -26, -9, -27, -8, 12, -9, -31, -8, -32, -57, -31, -58, -86, -115, -145, -176, -144, -111, -77, -112, -148, -111, -149, -188, -228, -187, -229, -272, -316, -271, -317, -270, -318, -269, -319, -370, -318, -371, -317, -372, -316
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2019

Keywords

Comments

The b-sequence (A309218) is 0; 1; 1; 1, 0, 0; 1, 0, 0, 0; 1, 1; 1, 1; 1, 0, 0; 1, 0, 0; ... Note that we write the binary expansions in human order (as in A309216), with high-order bits on the left.
This is a base-2 analog of A309216.

Crossrefs

Programs

  • Maple
    t:=0;
    a:=[0]; b:=[]; M:=100;
    for i from 1 to M do
    v1:=convert(abs(t),base,2); L:=nops(v1);
    v2:=[seq(v1[L-i+1],i=1..L)];
    b:=[op(b),op(v2)];
    if (b[i] mod 2) = 0 then t:=t+i else t:=t-i; fi;
    a:=[op(a),t];
    od:
    a; # A309217
    b; # A309218
Showing 1-5 of 5 results.