Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Golf -- compute PI

by thospel (Hermit)
on Mar 15, 2006 at 03:04 UTC ( [id://536763]=note: print w/replies, xml ) Need Help??


in reply to Golf -- compute PI

Pi to 1000 digits: 77 strokes, by tybalt89 with a minor change by ton:
($c,@0)=map P|($c=$c%($d=10+20*$?).0+$_*$?)/$d,@0while$?-=@0[0,1e3]=3; +print@0

78 strokes by ton:

print!s!\w+!$\=($z=$&.0+$?--*$\)/++($b=2*$?||239)|0;$z%$b!egfor(-48x65 +536)x1e3

Both can be extended for more digits

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://536763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-18 03:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found