Last active
December 29, 2020 15:44
-
-
Save hube12/ee3330b6d47a5c87a505a9f81e353b7a to your computer and use it in GitHub Desktop.
first digit factorial
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
| def first_digit(n): | |
| from math import exp,log,pi,modf,sqrt | |
| w=log((n/exp(1)),10) | |
| f,i=modf(w*n) | |
| l=10**f | |
| p=sqrt(2*pi*n) | |
| return str(p*l)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment