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

    On Perl 5.8.1 (Mac OS X 10.3.4) this doesn't seem to use bigint (as you apparently intended) unless I remove the =>.

    Update: OK, you fooled me. Good obfuscation, then!

      I use 5.6.x so don't actually have bigint. This is called obfuscation after all :-) The reason it does not work is that => is just a synonym for , in Perl so it reads use, bigint Or it should. Actually that , syntax parses as an error, whereas => syntax is OK GOK?

      C:\>type test.pl use, strict C:\>perl -MO=Deparse test.pl syntax error at test.pl line 1, near "use," test.pl had compilation errors. C:\>type test.pl use => strict C:\>perl -MO=Deparse test.pl '???', '???'; test.pl syntax OK C:\>

      cheers

      tachyon