# Software that can calculate PI to at least a thousand digits

I'm looking for software that can calculate pi (π).

I would like the software to meet these requirements,

• Simple as possible, something that just writes pi to either a text file or the command line.
• Actually calculates and finds pi as if it were doing it for the first time with just the software alone.
• Can calculate pi to at least a thousands digest without any problems.
• Why you want to generate digits of pi? Is the point to generate or use those?
– Olli
Feb 9, 2014 at 13:39
• If that question is phrased a bit differently ("Where can I find thousand digits of pi"), it could be off-topic for this site (IMO).
– Olli
Feb 9, 2014 at 14:28
• @Olli Yes. Thats why I didn't do it, this question is about which kind of answers are valid, not about if this kind of question is valid. Feb 9, 2014 at 14:56
• The best answer is download a list. This shows that the question, as asked, is not really a software recommendation and does not fit on this site. Feb 9, 2014 at 16:31
– Olli
Feb 9, 2014 at 16:50

You don't need to install any tool to calculate this. For example this page has JavaScript code that calculates an arbitrary number of pi decimals, up to 9999.

I validated it against this Python program, and it gave the same results. For some reason, it gives five additional digits, but those are on a separate line, so snipping it out is rather easy. Alternatively, just subtract 5 from the number of digits you want. Results are accurate, including those extra digits. This might depend on your browser, though (tested on Chrome on Android and Firefox on OS X).

• Here's example of webapp (?) that answers the question, without installing a software. The question does not ask for installable software.
– Olli
Feb 9, 2014 at 13:46
• This clearly is a webapp (it keeps its use if you would run it on your own server) and a good answer to the question. Feb 9, 2014 at 14:09
• Considering the digits: intuitively, I think it has to do with the convergence of the algorithm. I.e, try with 5 and 10, and see that the tenth digit for PI(5) changes. Might be more severe for larger N. Feb 9, 2014 at 14:12
• @Bernhard that's true. However, it could just print proper number of digits even if it needs more for calculations.
– Olli
Feb 9, 2014 at 14:20
• @AngeloNeuschitzer we're nicely drifting to meta discussion (which shouldn't happen here), but I truly think that "it keeps its use if you would run it on your own server" is not important at all for a good answer (if not required by the question, obviously).
– Olli
Feb 9, 2014 at 14:22

QuickPI is a Windows only command line tool that will generate pi to arbitrary length up to 256 million decimal places. It will optionally write this output to a text file.

By entering this command:

qpi 1mi -fancy:100,100,1000000,,no, pi.txt


I was able to generate the following output:

QPI-QuickPi v4.0, (c) 2000-2005 S. Pagliarulo
Freely distributable, email: [email protected]

o AMD A4-3400 APU with Radeon(tm) HD Graphics detected
o Processor speed measured at 2.70 GHz
o Single processor with dual cores
o 850.4 MB of memory available
o Using default training data

Computation of Pi to 1,000,000 digits
Method used : Chudnovsky
Started : Sun Feb 09 23:20:55 2014

Series size : 70514  (1,000,004 digits)
Series processing time : 1.07
Final value time : 0.20

Total time : 1.28 seconds
Total memory used : 12,263,030 (11.69 MB)
Processor utilization : 108.72%

Pi = 3.
1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196
4428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273
7245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094
3305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912
....  remainder omitted for brevity


There is a wealth of other utilities to calculate pi available here.

The differ in their supported:

• platforms (mainly Windows and Linux binaries, some source)
• maximum decimal places (PiFast claims 12 billion)
• performance characteristics

Not having used any of these other utilities I am unable to comment on individual features.

The symbolic and numeric calculation package Maxima appears capable of doing this rather easily. This is an open source (GPL) software project, available from Sourceforge.

I used the Xmaxima console for this result:

(%i1) bfloat(%pi),fpprec:1000; <enter>
(%o1) 3.1415926535897932384626433832795028841971693993751058209749445923078164\
062862089986280348253421170679821480865132823066470938446095505822317253594081\
284811174502841027019385211055596446229489549303819644288109756659334461284756\
482337867831652712019091456485669234603486104543266482133936072602491412737245\
870066063155881748815209209628292540917153643678925903600113305305488204665213\
841469519415116094330572703657595919530921861173819326117931051185480744623799\
627495673518857527248912279381830119491298336733624406566430860213949463952247\
371907021798609437027705392171762931767523846748184676694051320005681271452635\
608277857713427577896091736371787214684409012249534301465495853710507922796892\
589235420199561121290219608640344181598136297747713099605187072113499999983729\
780499510597317328160963185950244594553469083026425223082533446850352619311881\
710100031378387528865875332083814206171776691473035982534904287554687311595628\
63882353787593751957781857780532171226806613001927876611195909216420199b0


I can only vouch for the first thirty or so digits, personally.

To save the console output to a text file, use the menu item Edit -> Save Console to File.

• I don't think Maxima fulfills "It needs to be as simple as possible"
– Olli
Feb 9, 2014 at 15:05
• @Olli: Are you perhaps thinking Maxima is not simple because of the many other things Maxima can do? I assumed this task (find a thousand digits of pi) was meant to be representative of things one might want to do easily. Feb 9, 2014 at 15:24

You can use bc for it:

scale=1000
4*a(1)


With scale you define how many digits bc should calculate, so setting this to 1000 gives 1000 digits (see bc manual; by default it's set to 0). And in fact: 22/7 shows 3, but preceded by scale=1000 it gives … well, I won't quote that :)

On Linux systems, this app usually goes by a package of the same name – and is part of most distributions. So depending on the Linux flavour used, apt-get install bc (or the corresponding yum etc. commands) should install it.

• It should be noted that the last digit gets fudged but you can correct this by overcounting the scale and ignoring the last digit or you could use sed to remove the last digit: echo "scale=1001; 4*a(1)" | bc -l | sed "s/.\$//" Mar 15, 2021 at 0:52

Please check: Mini Pi which can compute Pi to millions of digits.

However to calculate Pi, you don't need a software, as the algorytm can be written in one or few lines in almost any language.

therefore there are unlimited possibilities of such softwares.

In Linux Pi can be printed (not calculated) by the following one-line commands:

• bc -l <<< "scale=1000; 4*a(1)"
• perl -Mbignum=bpi -wle 'print bpi(1000)'

or check: How do I print pi (3.14159)? at Unix

Related:

You don't need to use a tool to calculate this, you can just visit this website and copy as many digits as you like:

http://www.piday.org/million/

Important beta notice: This answer is a sample for this meta.

Please don't fix it, either a link to a website is a valid answer (then its good this way), or not (then we should downvote it).

• This does not answer the question (at least not the title), which says "Tool to calculate". It's different thing to calculate or to just have something.
– Olli
Feb 9, 2014 at 13:40
• So I have to figure where the thousandth digit is and copy from there? Not really an ideal solution.
– user9
Feb 9, 2014 at 13:40
• @olli yeah, was in the process of editing my comment, didn't see the tiny disclaimer font on my phone.
– user9
Feb 9, 2014 at 13:43
• @Gilles: no, that is not correct. This answer does not answer the question (ignoring comments). If the question is "Tool to calculate PI to a thousand digits", then it definitely is software recommendation question. Even if there's a shortcut, it still is. "Is there a tool to simulate this problem?" -> "Take this dataset" is not proper answer. There might easily be reasons why calculating it is important instead of just obtaining the results.
– Olli
Feb 9, 2014 at 16:47
• The request is “I want to have pi to a thousand digits”. So ok, technically the answer should say: use your web browser's “save as” function to store the result in a file. Feb 9, 2014 at 16:50