# Programming Pi

``` BBS: Inland Empire Archive
Date: 05-06-92 (11:30)             Number: 196
From: RICHARD VANNOY               Refer#: 152
To: ANDY KIDLE                    Recvd: NO
Subj: Programming Pi                 Conf: (2) Quik_Bas```
```AK>pi = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 +......)
AK>
AK>I'll have to write out the second one since their are no keys to
AK>represent exponents and square roots:

Sure there are.  AND they work in any BASIC program.

a * a = a^2
b * b * b = b^3
vc = c^.5

try this...
FOR i = 1 to 20
PRINT i, i^2, i^3, i^.5, i^.33333
NEXT i

As a hint for your infinite series, notice the divisors go
3, 5, 7, 9...

subtotal# = 1
minusSign% = 1
FOR i# = 3 TO SomeBigNumber# STEP 2
nextFraction# = 1 / i#
IF minusSign% THEN nextFraction# = -nextFraction#
subtotal# = subtotal# + nextFraction#
minusSign% = 1 - minusSign%    'REVERSE the sign
NEXT i
pi# = 4 * subtotal#
PRINT "SEE!  It's as easy as";pi#

> MegaMail 2.1b #0:The time travel lecture will be held last Monday

--- WM v2.01/91-0012
* Origin: Com-Dat BBS  Hillsboro, OR.  HST (503) 681-0543 (1:105/314)
```

Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET