Skip to content

Instantly share code, notes, and snippets.

@rgarcia
Created February 10, 2012 16:00
Show Gist options
  • Save rgarcia/1790473 to your computer and use it in GitHub Desktop.
Save rgarcia/1790473 to your computer and use it in GitHub Desktop.
x
def factorial_sumofdigits(n):
val = 1
for i in xrange(1,n+1):
val *= i
return sum([int(c) for c in str(val)])
for i in xrange(1,10000):
f = factorial_sumofdigits(i)
print i, f
if f == 8001:
print 'DONE'
break
# used the following js to get this:
# x = []
# $('p').each(function() { x.push($(this).parents().length); });
p_depths = [3, 9, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 9, 9, 9, 6, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 6, 6, 6, 6, 6, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 7, 6, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 7, 8, 8, 9, 9, 8, 8, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 6, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 7, 7, 6, 6, 6, 7, 6, 5, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 6, 6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6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 5, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3]
import numpy
print numpy.std(p_depths)
max_freq = 2520
total_words = sum([ float(max_freq)/float(i) for i in xrange(1,901)])
words = 0
for i in xrange(1,901):
words += float(max_freq)/float(i)
if words > total_words/2:
print i
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment