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.

This page as a plain text file.
%I A118822 #25 Jun 07 2025 05:22:09
%S A118822 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,
%T A118822 -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,
%U A118822 -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
%N A118822 Numerators of the convergents of the 2-adic continued fraction of zero given by A118821.
%H A118822 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,-1).
%F A118822 Period 8 sequence: [2,-1,0,-1,-2,1,0,1].
%F A118822 G.f.: -x*(x-1)*(x^2+x+2) / ( 1+x^4 ).
%F A118822 a(n) = sqrt((n+1)^2 mod 8)(-1)^floor((n+2)/4). - _Wesley Ivan Hurt_, Jan 01 2014
%e A118822 For n>=1, convergents A118822(k)/A118823(k) are:
%e A118822   at k = 4*n: -1/A080277(n);
%e A118822   at k = 4*n+1: -2/(2*A080277(n)-1);
%e A118822   at k = 4*n+2: -1/(A080277(n)-1);
%e A118822   at k = 4*n-1: 0/(-1)^n.
%e A118822 Convergents begin:
%e A118822   2/1, -1/-1, 0/-1, -1/1, -2/1, 1/0, 0/1, 1/-4,
%e A118822   2/-7, -1/3, 0/-1, -1/5, -2/9, 1/-4, 0/1, 1/-12,
%e A118822   2/-23, -1/11, 0/-1, -1/13, -2/25, 1/-12, 0/1, 1/-16,
%e A118822   2/-31, -1/15, 0/-1, -1/17, -2/33, 1/-16, 0/1, 1/-32, ...
%p A118822 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
%t A118822 Table[Sqrt[Mod[(n+1)^2, 8]](-1)^Floor[(n+2)/4], {n, 100}] (* _Wesley Ivan Hurt_, Jan 01 2014 *)
%o A118822 (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]}
%o A118822 for(n=0,80,print1(a(n),", "))
%o A118822 (PARI) {a(n) = [2,-1,0,-1,-2,1,0,1][(n-1)%8+1];} \\ _Joerg Arndt_, Jan 02 2014
%Y A118822 Cf. A118821 (partial quotients), A118823 (denominators).
%K A118822 frac,sign,easy
%O A118822 1,1
%A A118822 _Paul D. Hanna_, May 01 2006