Skip to content

Instantly share code, notes, and snippets.

@ThQ
Created February 11, 2012 00:34
Show Gist options
  • Save ThQ/1794468 to your computer and use it in GitHub Desktop.
Save ThQ/1794468 to your computer and use it in GitHub Desktop.
e-ly
def R(n):
fact = 1
for i in range (1, n+1):
fact = fact * i
res = 0
for c in str(fact):
res += int(c)
return res
i = 0
while True:
val = R(i)
if val == 8001:
print("i=" + str(i) + " ; val = " + str(val))
break
i += 1
import numpy
f = open("html_2.txt", "r")
if f:
cont = f.read()
level = 0
buff = ""
ps = []
for i in range(0, len(cont)):
c = cont[i]
if c == "<":
buff = ""
elif c == ">":
if buff[0] == "/":
level -= 1
else:
if buff == "p":
ps.append(level)
level += 1
else:
buff += c
print(round(numpy.std(ps),1))
f.close()
tot = 0
for i in range (1, 901):
tot += 1/i
half = 0.5 * tot
tot = 0
for i in range(1, 901):
tot += 1/i
if tot > half:
print(i)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment