Last active
November 3, 2023 18:09
-
-
Save ZSendokame/b5e87473bbedfdd7406f34920e276760 to your computer and use it in GitHub Desktop.
Euler number approximation. Instead of using math.factorial, used that little trick. Discovered while thinking how to make it faster and more precise, didn't found a way to make it more precise
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
def euler() -> Decimal: | |
e = Decimal(0) | |
f = 1 | |
for n in range(2, 100_000): | |
f *= n | |
e += Decimal((1 / f)) | |
return e + 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment