Finds the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital >>> solution() 45228
()
| 38 | |
| 39 | |
| 40 | def 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 | |
| 58 | if __name__ == "__main__": |
no test coverage detected