What are the PARI/GP alternatives to contfrac() ?

pauldhanna at juno.com pauldhanna at juno.com
Sat Dec 29 02:18:06 CET 2007


Seqfans, 
    Since we are on the subject of Pi and continued fractions, 
I would like to share an example of how PARI's contfrac routine 
can generate interesting CF expressions and sequences. 
 
Consider the function:  Sum_{m>=0} 1/x^(2^m-1)/(m+1)^s 
which equals zeta(s) at x=1.
 
PARI returns an interesting expression for this function: 
 
contfrac(sum(m=0,6, 1/x^(2^m-1)/(m+1)^s ))
 
= [1; 2^s/x, -(3/4)^s/x, -2^s/x, -(4/9)^s/x, 2^s/x, (3/4)^s/x, ...,
Q(n,s)/x, ...]
 
where the partial quotients have the signed fractional values given by: 
 
Q(n,s) = (-1)^A073089(n+1) * ( [A007814(n) + 2] / [A007814(n) + 1]^2 )^s 
  
where A007814(n) the exponent of highest power of 2 dividing n, 
and A073089(n) = (1/2)*(4n - 3 - Sum_{k=1..n} A007400(k) ) 
and A007400 = Continued fraction for Sum_{n>=0} 1/2^(2^n).
 
An interesting property of this continued fraction is that 
the (2^n-1)-th convergent = Sum_{k=0..n} x^(1-2^k)/(k+1)^s 
(exactly). 
 
Below I give a few examples. 
    Paul 
  
EXAMPLE s=1:
1 + 1/2*x^-1 + 1/3*x^-3 + 1/4*x^-7 + 1/5*x^-15 + 1/6*x^-31 + 1/7*x^-63
+...

contfrac(sum(m=0,7, 1/x^(2^m-1)/(m+1) ))

= [1; 2x, -3/4x, -2x, -4/9x, 2x, 3/4x, -2x, -5/16x, 2x, -3/4x, 
-2x, 4/9x, 2x, 3/4x, -2x, -6/25x, 2x, -3/4x, -2x, -4/9x, 2x, 
3/4x, -2x, 5/16x, 2x, -3/4x, -2x, 4/9x, 2x, 3/4x, -2x, -7/36x, 
2x, -3/4x, -2x, -4/9x, 2x, 3/4x, -2x, -5/16x, 2x, -3/4x, -2x, 
4/9x, 2x, 3/4x, -2x, 6/25x, 2x, -3/4x, -2x, -4/9x, 2x, 3/4x, 
-2x, 5/16x,2x, -3/4x, -2x, 4/9x, 2x, 3/4x, -2x, -8/49x, ...]
 
EXAMPLE s=2:
1 + 1/4*x^-1 + 1/9*x^-3 + 1/16*x^-7 + 1/25*x^-15 + 1/36*x^-31 +
1/49*x^-63 +...

contfrac(sum(m=0,7, 1/x^(2^m-1)/(m+1)^2 ))

= [1; 4x, -9/16x, -4x, -16/81x, 4x, 9/16x, -4x, -25/256x, 4x, -9/16x, 
-4x, 16/81x, 4x, 9/16x, -4x, -36/625x, 4x, -9/16x, -4x, -16/81x, 4x, 
9/16x, -4x, 25/256x, ...]
 
EXAMPLE s=3:
1 + 1/8*x^-1 + 1/27*x^-3 + 1/64*x^-7 + 1/125*x^-15 + 1/216*x^-31 +
1/343*x^-63 +...

contfrac(sum(m=0,7, 1/x^(2^m-1)/(m+1)^3 ))

= [1; 8x, -27/64x, -8x, -64/729x, 8x, 27/64x, -8x, -125/4096x, 8x,
-27/64x, 
-8x, 64/729x, 8x, 27/64x, -8x, -216/15625x, 8x, -27/64x, -8x, -64/729x,
8x, 27/64x, ...]
 
END.





More information about the SeqFan mailing list