Ed S on Nostr: #bbcmicrobot 🚀 L%=2000:Z%=SQR(L%):P=6*1/(1-1/2/2) DIM S% L%+2 ...
#bbcmicrobot 🚀
L%=2000:Z%=SQR(L%):P=6*1/(1-1/2/2)
DIM S% L%+2
FORI%=1TOL%+1STEP4:S%!I%=TRUE:NEXT
P%=2
REPEAT
FORI%=P%*P%TOL%STEPP%:S%?I%=0:NEXT
REPEATP%=P%+1:UNTILS%?P%
UNTIL P%>Z%
FOR I%=3 TO L% STEP 2
IF S%?I% P=P*1/(1-1/I%/I%):PRINT I%;" ";SQR(P)
NEXT
PRINT"pi approximated using primes, per Euler"
L%=2000:Z%=SQR(L%):P=6*1/(1-1/2/2)
DIM S% L%+2
FORI%=1TOL%+1STEP4:S%!I%=TRUE:NEXT
P%=2
REPEAT
FORI%=P%*P%TOL%STEPP%:S%?I%=0:NEXT
REPEATP%=P%+1:UNTILS%?P%
UNTIL P%>Z%
FOR I%=3 TO L% STEP 2
IF S%?I% P=P*1/(1-1/I%/I%):PRINT I%;" ";SQR(P)
NEXT
PRINT"pi approximated using primes, per Euler"