Skip to content

Instantly share code, notes, and snippets.

@Vuong-Chu
Created May 30, 2023 10:14
Show Gist options
  • Save Vuong-Chu/f7fa71140daedc45a0b008e7fac7745d to your computer and use it in GitHub Desktop.
Save Vuong-Chu/f7fa71140daedc45a0b008e7fac7745d to your computer and use it in GitHub Desktop.
import math
def Wallis_Pi(n):
'''
Compute the decimals of Pi using the Wallis formula:
'''
return 2*math.prod([4*i**2 / (4*i**2 - 1) for i in range(1, n + 1)])
Wallis_Pi(100_000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment