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

Function solution

project_euler/problem_043/sol1.py:51–62  ·  view source on GitHub ↗

Returns the sum of all pandigital numbers which pass the divisibility tests. >>> solution(10) 16695334890

(n: int = 10)

Source from the content-addressed store, hash-verified

49
50
51def solution(n: int = 10) -> int:
52 """
53 Returns the sum of all pandigital numbers which pass the
54 divisibility tests.
55 >>> solution(10)
56 16695334890
57 """
58 return sum(
59 int("".join(map(str, num)))
60 for num in permutations(range(n))
61 if is_substring_divisible(num)
62 )
63
64
65if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

is_substring_divisibleFunction · 0.85

Tested by

no test coverage detected