|
Python- from itertools import product
- from collections import Counter
- def is_valid_tuple(t):
- for signs in product([-1, 1], repeat=4):
- if sum(sign * num for sign, num in zip(signs, t)) % 9 == 0:
- return True
- return False
- def has_one_number_appearing_three_times(t):
- transformed = [abs((x + 4) % 9 - 4) for x in t]
- counts = Counter(transformed)
- return 3 in counts.values() and len(counts) == 2
- for t in product((1,2,4,5,7,8), repeat=4):
- if is_valid_tuple(t) == has_one_number_appearing_three_times(t):
- print(t, 'failed')
- print('done')
复制代码 验证完毕!没有反例。
请问如何证明呢? |
|