Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (19 sloc) 547 Bytes
#
# Solution to Project Euler problem 70
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import eulerlib
def compute():
totients = eulerlib.list_totients(10**7 - 1)
minnumer = 1
mindenom = 0
for (i, tot) in enumerate(totients[2 : ], 2):
if i * mindenom < minnumer * tot and sorted(str(i)) == sorted(str(tot)):
minnumer = i
mindenom = totients[i]
return str(minnumer)
if __name__ == "__main__":
print(compute())