21 lines
697 B
Python
21 lines
697 B
Python
|
|
def calc(limit):
|
|
return sum(map(lambda x:
|
|
sum(map(x[0], filter(x[1], map(x[2], range(1, x[3]))))),
|
|
[
|
|
(
|
|
lambda x: 2 * sum(x) ** 2,
|
|
lambda x: 2 * x[0] * x[1] + 1 == (x[0] - x[1]) ** 2,
|
|
lambda x: (int((2 + 3 ** 0.5) * x) + 1, x),
|
|
int((limit / (2 + 3 ** 0.5) / 12) ** 0.5)
|
|
),
|
|
(
|
|
lambda x: 4 * x[0],
|
|
lambda x: 3 * x[1] + 1 == x[0],
|
|
lambda x: (int((3 ** 0.5) * x + 1) ** 2, x ** 2),
|
|
int((limit / 12) ** 0.5)
|
|
)
|
|
]))
|
|
|
|
print(calc(1000000000))
|