Solve problem 97
parent
b7f1011b54
commit
42907eeaba
|
@ -2,6 +2,6 @@
|
|||
|
||||
Project Euler discourages sharing solutions to the problem. Since there are
|
||||
plenty solutions out there on the internet I violate this rule for now. My goal
|
||||
for know is to finish one hundred problems. After that I might change the
|
||||
for now is to finish one hundred problems. After that I might change the
|
||||
repository to private.
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
|
||||
def euler_091():
|
||||
n = 2
|
||||
qs = [(x, y)
|
||||
for x in range(n + 1)
|
||||
for y in range(n + 1)]
|
||||
|
||||
def count_possible_right_triangles(q):
|
||||
o = (0, 0)
|
||||
if o == q:
|
||||
return 0
|
||||
|
||||
ps = [(x, y)
|
||||
for x in range(n + 1)
|
||||
for y in range(q[0], n + 1)]
|
||||
for p in ps:
|
||||
if q == p:
|
||||
continue
|
||||
print(o, q, p)
|
||||
|
||||
return 0
|
||||
|
||||
s = sum(map(count_possible_right_triangles, qs))
|
||||
return s
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution = euler_091()
|
||||
print("e091.py: " + str(solution))
|
||||
assert(solution == 0)
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
def euler_097():
|
||||
mod = 10**10 # we want the last ten digits
|
||||
s = 1
|
||||
for _ in range(7830457):
|
||||
s = (s * 2) % mod
|
||||
s = (28433 * s) % mod
|
||||
s = s + 1
|
||||
return s
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution = euler_097()
|
||||
print("e097.py: " + str(solution))
|
||||
assert(solution == 8739992577)
|
||||
|
Loading…
Reference in New Issue