Solve problem 87
parent
9d4a08297e
commit
b0cccc97ab
|
@ -0,0 +1,9 @@
|
|||
|
||||
def euler_086():
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution = euler_086()
|
||||
print("e086.py: " + str(solution))
|
||||
assert(solution == 0)
|
|
@ -0,0 +1,30 @@
|
|||
from lib_prime import primes
|
||||
|
||||
|
||||
def euler_087():
|
||||
n_max = 50000000
|
||||
ps = primes(10**5)
|
||||
found = set()
|
||||
c = 0
|
||||
for p4 in ps:
|
||||
p4s = p4 ** 4
|
||||
if p4 > n_max:
|
||||
break
|
||||
for p3 in ps:
|
||||
p3s = p3 ** 3
|
||||
if p4s + p3s > n_max:
|
||||
break
|
||||
for p2 in ps:
|
||||
p2s = p2 ** 2
|
||||
p = p2s + p3s + p4s
|
||||
if p < n_max and not p in found:
|
||||
c += 1
|
||||
found.add(p)
|
||||
return c
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution = euler_087()
|
||||
print("e087.py: " + str(solution))
|
||||
assert(solution == 1097343)
|
||||
#
|
|
@ -1,5 +1,5 @@
|
|||
FROM = 85
|
||||
TILL = 85
|
||||
FROM = 88
|
||||
TILL = 90
|
||||
|
||||
template = """
|
||||
def euler_XXX():
|
||||
|
|
Loading…
Reference in New Issue