MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / solution

Function solution

project_euler/problem_038/sol1.py:58–73  ·  view source on GitHub ↗

Return the largest 1 to 9 pandigital 9-digital number that can be formed as the concatenated product of an integer with (1,2,...,n) where n > 1.

()

Source from the content-addressed store, hash-verified

56
57
58def solution() -> int | None:
59 """
60 Return the largest 1 to 9 pandigital 9-digital number that can be formed as the
61 concatenated product of an integer with (1,2,...,n) where n > 1.
62 """
63 for base_num in range(9999, 4999, -1):
64 candidate = 100002 * base_num
65 if is_9_pandigital(candidate):
66 return candidate
67
68 for base_num in range(333, 99, -1):
69 candidate = 1002003 * base_num
70 if is_9_pandigital(candidate):
71 return candidate
72
73 return None
74
75
76if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

is_9_pandigitalFunction · 0.85

Tested by

no test coverage detected