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

Function solution

project_euler/problem_032/sol32.py:40–55  ·  view source on GitHub ↗

Finds the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital >>> solution() 45228

()

Source from the content-addressed store, hash-verified

38
39
40def solution():
41 """
42 Finds the sum of all products whose multiplicand/multiplier/product identity
43 can be written as a 1 through 9 pandigital
44
45 >>> solution()
46 45228
47 """
48
49 return sum(
50 {
51 int("".join(pandigital[5:9]))
52 for pandigital in itertools.permutations("123456789")
53 if is_combination_valid(pandigital)
54 }
55 )
56
57
58if __name__ == "__main__":

Callers 1

sol32.pyFile · 0.70

Calls 1

is_combination_validFunction · 0.85

Tested by

no test coverage detected