The Bailey-Borwein-Plouffe formula, discovered in 1995, allows to calculate any digit of π (in base 16) without calculating the preceding digits.pic.twitter.com/qu2a2CF7g7
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
Here is a complete one in #JuliaLang
using Decimals
pi_prec(p)=sum(1/Decimal(16)^k *
(Decimal(4)/(8*k+1)-
Decimal(2)/(8*k+4)-
Decimal(1)/(8*k+5)-
Decimal(1)/(8*k+6)) for k in 0:p-1)
for anyone not familiar with python, you should add this at the top: from decimal import *
I love that you had uploaded a Python implementation :D To contribute... This snippets needs imports at the top from decimal import Decimal from decimal import getcontext And you have a typo in "xrange", now it is "range" without the "x". If you know what I mean ;)
I feel the imports were assumed. xrange still works but of course range is better.
That is *incredible*.
The results are a little wonky. Giving this function the numbers 12 through 16 provides the following results: - 3.14159265358 3.141592653590 3.1415926535898 3.14159265358978 3.141592653589793
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.