Skip to content

Instantly share code, notes, and snippets.

@hube12
Last active December 29, 2020 15:44
Show Gist options
  • Select an option

  • Save hube12/ee3330b6d47a5c87a505a9f81e353b7a to your computer and use it in GitHub Desktop.

Select an option

Save hube12/ee3330b6d47a5c87a505a9f81e353b7a to your computer and use it in GitHub Desktop.
first digit factorial
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