Skip to content

Instantly share code, notes, and snippets.

@lfranchi
Created February 10, 2012 21:26
Show Gist options
  • Select an option

  • Save lfranchi/1793004 to your computer and use it in GitHub Desktop.

Select an option

Save lfranchi/1793004 to your computer and use it in GitHub Desktop.
mostfreq = 2520
l = []
for i in range(1, 901):
l.append(mostfreq/i)
total = sum(l)
print l, " of length: ", len(l)
print "Total num of words is: %s and half is %s" % (total, total/2)
cur = 0
for i in range(1, len(l) + 1):
cur += l[i-1]
print "Checking unique word num: %s, current total is: %s" % (i, cur)
if cur >= total/2:
print "Got Half: %s" % i
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment