-
Notifications
You must be signed in to change notification settings - Fork 0
/
pb282.py
37 lines (36 loc) · 866 Bytes
/
pb282.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
from euler import *
def A(m, n, cache={}):
if (m,n) in cache:
return cache[(m,n)]
if m == 0:
return n + 1
elif m == 1:
return n + 2
elif m == 2:
return 2 * n + 3
elif m == 3:
return 2 ** (n + 3) - 3
elif n == 0:
return A(m - 1, 1, cache)
else:
return A(m - 1, A(m, n - 1, cache), cache)
import sys
sys.setrecursionlimit(3000)
sum([A(n,n) for n in range(7)]) % 14**8
exit()
cache = {}
for i in xrange(0, 100):
progress((i-1)*100, 10000, 1)
for j in xrange (0, 100):
if (i,j) in cache or i in (0,1,2,3):
continue
progress(i*100 + j, 10000, 1)
try:
cache[(i,j)] = A(i,j, cache)
except RuntimeError:
print "fail ", (i,j)
pass
print cache
for i in cache:
if i not in old_cache:
print i