New sequences

Thomas Baruchel baruchel at bluebottle.com
Fri Dec 9 23:38:56 CET 2005


On Ven, déc 09, 2005 at 04:30:07 +0100, Tautócrona wrote:
> Simple continued fraction:
> [0,2,3,5,...,19] = 0.4323320871859025970563837017
> ( 1/(2+1/(3+1/(5+...)...) )
> General continued fraction I:
> [0,2,3,5,...,43] = 0.5492171239377731435910913301
> ( 2/(3+5/(7+...)...) )
> General continued fraction II:
> [0,1,2,3...,41] = 0.3943175562539635133683360441
> ( 1/(2+3/(5+...)...) )

I already answered to you for the simple continued fraction, but didn't
at that time notice that you also were interested by general continue
fraction. Here is the general rule for computing everything. Never
think backward, it is a bad thing.

First initialize a matrix to [1,0;0,1]
Then compute m = m * [a,b;1,0] with a being the denominator and b the numerator.
In your last example,
m=[1,0;0,1];k=1;for(i=1,200,k0=nextprime(k+1);k=nextprime(k0+1);m=m*[k0,k;1,0]);m[1,1]/m[2,1]+.
will give 2.5360270816893383923069 (inverse of your own value).
Of course you can put more than 200 if you want the result to be more accurate.

In the other example:
m=[1,0;0,2];k=2;for(i=1,200,k0=nextprime(k+1);k=nextprime(k0+1);m=m*[k0,k;1,0]);m[1,1]/m[2,1]+.
Is a little more tricky but you will understand, I am sure.

The third program was in my previous mail.

-- 
Thomas Baruchel
  Home Page: http://baruchel.free.fr/~thomas/





More information about the SeqFan mailing list