Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from fractions import gcd
|
||||
|
||||
from math import gcd
|
||||
|
||||
def pt1(maxperimeter=100):
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
from sys import setrecursionlimit
|
||||
from functools import reduce
|
||||
|
||||
setrecursionlimit(2000) # 2000 ought to be big enough for everybody
|
||||
|
||||
def triples(lim, a = 3, b = 4, c = 5):
|
||||
l = a + b + c
|
||||
if l > lim: return (0, 0)
|
||||
return reduce(lambda x, y: (x[0] + y[0], x[1] + y[1]), [
|
||||
(1, lim / l),
|
||||
(1, lim // l),
|
||||
triples(lim, a - 2*b + 2*c, 2*a - b + 2*c, 2*a - 2*b + 3*c),
|
||||
triples(lim, a + 2*b + 2*c, 2*a + b + 2*c, 2*a + 2*b + 3*c),
|
||||
triples(lim, -a + 2*b + 2*c, -2*a + b + 2*c, -2*a + 2*b + 3*c) ])
|
||||
|
||||
for peri in [10 ** e for e in range(1, 8)]:
|
||||
print peri, triples(peri)
|
||||
print(peri, triples(peri))
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
10 (0, 0)
|
||||
100 (7, 17)
|
||||
1000 (70, 325)
|
||||
10000 (703, 4858)
|
||||
100000 (7026, 64741)
|
||||
1000000 (70229, 808950)
|
||||
10000000 (702309, 9706567)
|
||||
Loading…
Add table
Add a link
Reference in a new issue