1 REM PI CALCULATOR, B. WATSON, URCHLAY AT SLACKWARE.UK 3 REM PORTED FROM PYTHON3, FROM "LEARNPYTHON" PROJECT ON GITHUB 5 REM THE PYTHON VERSION IS MIT-LICENSED. 10 PRINT "CALCULATE HOW MANY DIGITS OF PI"; 20 INPUT P 25 LET P=INT(P) 30 IF P>=1 THEN 60 40 PRINT "PLEASE ENTER A POSITIVE NUMBER." 50 GOTO 10 60 IF P<20 THEN 100 70 PRINT "WARNING: PROGRAM ONLY ACCURATE TO 20 DIGITS OR SO." 100 LET Q=1 110 LET R=0 120 LET T=1 130 LET K=1 140 LET N=3 150 LET L=3 160 LET C=0 200 IF (4*Q+R-T)>=(N*T) THEN 300 210 PRINT N; 215 IF C>0 THEN 220 217 PRINT "."; 220 LET C=C+1 230 IF C=P THEN 500 240 LET R1=10*(R-N*T) 250 LET N=INT((10*(3*Q+R))/T)-10*N 260 LET Q=Q*10 270 LET R=R1 280 GOTO 200 300 LET R1=(2*Q+R)*L 310 LET N1=INT((Q*(7*K)+2+(R*L))/(T*L)) 320 LET Q=Q*K 330 LET T=T*L 340 LET L=L+2 350 LET K=K+1 360 LET N=N1 370 LET R=R1 380 GOTO 200 500 PRINT 510 REM THE PRINT ABOVE IS NEEDED TO MAKE MINIMALBASIC FLUSH ITS 520 REM OUTPUT BUFFER. OTHERWISE WE GET NO OUTPUT! 9999 END