Skip to content

Instantly share code, notes, and snippets.

@highfestiva
Created December 15, 2019 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save highfestiva/1e21e0f6cd7d95c2222172f9a9e613e8 to your computer and use it in GitHub Desktop.
Save highfestiva/1e21e0f6cd7d95c2222172f9a9e613e8 to your computer and use it in GitHub Desktop.
Calculate PI with an incredibly low accuracy
#!/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