Returns the sum of all pandigital numbers which pass the divisibility tests. >>> solution(10) 16695334890
(n: int = 10)
| 49 | |
| 50 | |
| 51 | def 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 | |
| 65 | if __name__ == "__main__": |
no test coverage detected