in reply to e with continued fractions
Diabolical. You can make the ASCII quite pretty too:
;;$|++;use=> bigint;my($a,$b,$c,$d ,$m,$n) =(0,1,1 ,0,0,0) ;while (){if( $b&&$d &&(my$ e=int( $a/$b))==int($c/$d)){$a=10*($a-$b*$ e);$c=10*($c-$d*$e);print$e;}else{$ e=$a;$ a=$c;$ c=$c*( ($m%3) %2?$n* 2:1) +$e;$e=$ b;$b=$ d;$d=$d*(($m++%3)%2?$n++ *2:1)+$e;}};#e
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: e with continued fractions
by jdalbec (Deacon) on Jul 22, 2004 at 03:29 UTC | |
by tachyon (Chancellor) on Jul 22, 2004 at 04:16 UTC |