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

%I #22 Dec 14 2023 05:25:10

%S 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 -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 -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 Numerators of the convergents of the 2-adic continued fraction of zero given by A118821.

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,-1).

%F Period 8 sequence: [2,-1,0,-1,-2,1,0,1].

%F G.f.: -x*(x-1)*(x^2+x+2) / ( 1+x^4 ).

%F a(n) = sqrt((n+1)^2 mod 8)(-1)^floor((n+2)/4). - _Wesley Ivan Hurt_, Jan 01 2014

%e For n>=1, convergents A118822(k)/A118823(k) are:

%e at k = 4*n: -1/A080277(n);

%e at k = 4*n+1: -2/(2*A080277(n)-1);

%e at k = 4*n+2: -1/(A080277(n)-1);

%e at k = 4*n-1: 0/(-1)^n.

%e Convergents begin:

%e 2/1, -1/-1, 0/-1, -1/1, -2/1, 1/0, 0/1, 1/-4,

%e 2/-7, -1/3, 0/-1, -1/5, -2/9, 1/-4, 0/1, 1/-12,

%e 2/-23, -1/11, 0/-1, -1/13, -2/25, 1/-12, 0/1, 1/-16,

%e 2/-31, -1/15, 0/-1, -1/17, -2/33, 1/-16, 0/1, 1/-32, ...

%p 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 Table[Sqrt[Mod[(n+1)^2, 8](-1)^Floor[(n+2)/4], {n, 100}] (* _Wesley Ivan Hurt_, Jan 01 2014 *)

%o (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 for(n=0,80,print1(a(n),", "))

%o (PARI) {a(n) = [2,-1,0,-1,-2,1,0,1][(n-1)%8+1];} \\ _Joerg Arndt_, Jan 02 2014

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

%K frac,sign

%O 1,1

%A _Paul D. Hanna_, May 01 2006