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.

A118822 Numerators of the convergents of the 2-adic continued fraction of zero given by A118821.

Original entry on oeis.org

2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1, -2, 1, 0, 1, 2, -1, 0, -1
Offset: 1

Views

Author

Paul D. Hanna, May 01 2006

Keywords

Examples

			For n>=1, convergents A118822(k)/A118823(k) are:
  at k = 4*n: -1/A080277(n);
  at k = 4*n+1: -2/(2*A080277(n)-1);
  at k = 4*n+2: -1/(A080277(n)-1);
  at k = 4*n-1: 0/(-1)^n.
Convergents begin:
  2/1, -1/-1, 0/-1, -1/1, -2/1, 1/0, 0/1, 1/-4,
  2/-7, -1/3, 0/-1, -1/5, -2/9, 1/-4, 0/1, 1/-12,
  2/-23, -1/11, 0/-1, -1/13, -2/25, 1/-12, 0/1, 1/-16,
  2/-31, -1/15, 0/-1, -1/17, -2/33, 1/-16, 0/1, 1/-32, ...
		

Crossrefs

Cf. A118821 (partial quotients), A118823 (denominators).

Programs

  • Maple
    A118822:=n->sqrt((n+1)^2 mod 8)*(-1)^floor((n+2)/4); seq(A118822(n), n=1..100); # Wesley Ivan Hurt, Jan 01 2014
  • Mathematica
    Table[Sqrt[Mod[(n+1)^2, 8]](-1)^Floor[(n+2)/4], {n, 100}] (* Wesley Ivan Hurt, Jan 01 2014 *)
  • PARI
    {a(n)=local(p=+2,q=-1,v=vector(n,i,if(i%2==1,p,q*2^valuation(i/2,2)))); contfracpnqn(v)[1,1]}
    for(n=0,80,print1(a(n),", "))
    
  • PARI
    {a(n) = [2,-1,0,-1,-2,1,0,1][(n-1)%8+1];} \\ Joerg Arndt, Jan 02 2014

Formula

Period 8 sequence: [2,-1,0,-1,-2,1,0,1].
G.f.: -x*(x-1)*(x^2+x+2) / ( 1+x^4 ).
a(n) = sqrt((n+1)^2 mod 8)(-1)^floor((n+2)/4). - Wesley Ivan Hurt, Jan 01 2014