Today's date recalls one interesting task from spoj.pl.
It's easy - just print as many correct Pi decimal digits as possible.
I've tried a lot of methods
from easiest (~200 digits)
![](/predownloaded/91/2e/912e404e464e30f9dd076ee18425ca42892d7c6f.png)
![](/predownloaded/1f/04/1f04294d6801ee761a1d3f1426b940f5867414f6.png)
through funny (~1000 digits)
![](/predownloaded/d7/7e/d77e1c6c472818788baa97b5b5731350a5e0681f.png)
to the most effective I've found (~7300 digits)
![](/predownloaded/c1/22/c122333d7ce375a707ae08366d75f9f616560aef.png)
![](/predownloaded/bf/8f/bf8f31e5cc492ebd363f5ca457c8a5305e768c66.png)
![](/predownloaded/71/f3/71f3774e13c147e42dc03706353df4de68cf97ce.png)
![](/predownloaded/8b/b6/8bb614ae050fd89d6377d257ef571a6f105a7073.png)
Also I have an idea to use this tricky formula
![](/predownloaded/20/99/209912d7366af60b73c7834c60fddf6b04d8cb2c.png)
to find hexadecimal digits and convert them to decimal.
My best solution is written in Java and uses BigDecimal and self-written sqrt.
May be I should optimize long arithmetics? Or search for new methods?
Please help me to calculate billion digits =)