-
-
Save shujaatak/6264974d084ee21c4f47c924f7a43cab to your computer and use it in GitHub Desktop.
Calculate PI with an incredibly low accuracy
This file contains hidden or 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