P is for Practical  
PerlMonks 
pi and some continued fractionsby spx2 (Chaplain) 
on Nov 08, 2009 at 18:09 UTC ( #805800=perlmeditation: print w/ replies, xml )  Need Help?? 
Today I thought I'd implement a way to compute pi using continued fractions I was trying to get 1000 decimals for codegolf.com , but I was only able to get 10 correct decimals(yes, I know..pathetic) in 6 seconds(codegolf limits this to 4 seconds). I used the formula here(the one in the middle),and wrote code that weighs at about 140 bytes , but the 1st entry in codegolf.com for this problem has 54 bytes or so. Anyone care to divulge their (partial) solution to this ? Maybe they treat the problem as one of compressing those 1000 digits rather than computing them? And if so, I think there were some theoretical bounds to compressing data, I do not remember what those were ... I'm pretty sure codegolf doesn't allow use of modules and implementing your own compression algo would jump over 54bytes for sure , or not ?
Back to
Meditations

