-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheuler64.py
55 lines (47 loc) · 1.01 KB
/
euler64.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from decimal import *
getcontext().prec = 5000
def sqrtf(n):
a=Decimal(n).sqrt()
ls=[int(a)]
check=[str(a)[:7]]
rest=a%1
for i in range(10000):
if i==9999:
print "ERROR", n
print "ERROR", n
print "ERROR", n
print "ERROR", n
raw_input()
a=1/rest
rest=a%1
if str(a)[:7] in check:
check.append(str(a)[:7])
break
else:
check.append(str(a)[:7])
ls.append(int(a))
return ls
def counter():
count=0
toss=[]
for i in range(1,10001):
print i
try:
if len(sqrtf(i))%2==0:
count+=1
except:
toss.append(i)
continue
return count
def superroot(a):
n=0
ls=[]
for x in range(0,100):
ls.append(pow(10,x))
for i in ls:
while n*n<a:
print n
if (n+(1.0/i))**2>a:
break
else: n+=(1.0/i)
return n