in reply to Golf -- compute PI

An apparent 67.
#000000001111111111222222222233333333334444444444555555555566666666 #234567890123456789012345678901234567890123456789012345678901234567 $i=43;$p=1;eval'$x'.chr($i).'=4/$p;$p+=2;$i^=6'for 1..10**5;print$x
update :
#0000000011111111112222222222333333333344444444445555555555 #2345678901234567890123456789012345678901234567890123456789 $o=1;$t=3;for(1..1e5){$e+=(4/$o)-(4/$t);$o+=4;$t+=4}print$e

Simplify, simplify... :)
update :
to Chmrr : (1**5) yeah, I saw that in another solution and felt rather sheepish. As to the exact value of the number, I felt it appropriate to use something approximate to Ovid's original algorithm.

Replies are listed 'Best First'.
Re: Re: Golf -- compute PI (boo)
by Chmrr (Vicar) on Apr 16, 2002 at 02:55 UTC

    1e5 is shorter than 10**5. This applies equally to all of the solutions given so far. However, as this number only defines the accuracy of the answer, it is arguable that the length of this number should not be counted towards the total par for the answer..

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

      Another "short than 10**5" option is to use a..eqxe instead.

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;