Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (17 sloc) 466 Bytes
#
# Solution to Project Euler problem 38
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
def compute():
ans = ""
for n in range(2, 10):
for i in range(1, 10**(9 // n)):
s = "".join(str(i * j) for j in range(1, n + 1))
if "".join(sorted(s)) == "123456789":
ans = max(s, ans)
return ans
if __name__ == "__main__":
print(compute())