Created
December 15, 2019 01:31
-
-
Save highfestiva/1e21e0f6cd7d95c2222172f9a9e613e8 to your computer and use it in GitHub Desktop.
Calculate PI with an incredibly low accuracy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
terms = (int(sys.argv[1]) + 1) // 2 | |
pi = 4 + sum(4/-(v*4+3) + 4/(v*4+5) for v in range(terms)) | |
print(pi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment