Skip to content

Commit

Permalink
Update pi.py
Browse files Browse the repository at this point in the history
  • Loading branch information
daedalus committed Mar 7, 2024
1 parent cf8b647 commit 69dbfbc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pi.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
leibniz_pi = lambda n: 4*sum(((-1)**(k-1))/(k*2-1) for k in range(1, n+1))
leibniz_pi = lambda n: 4*sum(((-1)*((k-1)&1)+((k-1)&1==0))/((k<<1)-1) for k in range(1, n+1))

0 comments on commit 69dbfbc

Please sign in to comment.