Compute pi to base 12 using Python?

Dick Moores rdm at rcblue.com
Sun Apr 17 04:00:46 EDT 2005


M.E.Farmer wrote at 23:18 4/14/2005:
> > >Using the GNU "bc" utility:
> > >
> > >   $ bc -l
> > >   bc 1.06
> > >   Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation,
>Inc.
> > >   This is free software with ABSOLUTELY NO WARRANTY.
> > >   For details type `warranty'.
> > >   scale = 3000    # number of output places wanted
> > >   obase = 12      # output base
> > >   print 4 * a(1)  # pi = 4*arctan(1)

Wow! this got me the 3003 (changed from 3000) digits of pi to base 12 in 
60.8 secs. No, I didn't count them yet, nor am I sure they're correct. 
But I'd bet on them..

Could someone remind me how to get the output of bc -l into a text file 
on Windows? (I've tried employing " > pi3003.txt" in various ways) OR, 
how to copy and paste from the command line window, or whatever that 
window is called? (Sorry for the OT question.)

BTW I found a nice set of SCO UNIX man pages at <http://www.rt.com/man/>.

Dick





More information about the Python-list mailing list