使用双重散列从表1到表2记录碰撞次数
number = 11
first_prime = [11, 13, 17, 19, 23, 29, 31]
second_prime = [2, 3, 5, 7]
results = [[0]*len(first_prime) for i in range(len(second_prime))]
print('\n'.join([''.join(['{:4}'.format(item) for item in row])
for row in results]))
有:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
想:
26 12 4 3 2 2 0
12 16 2 4 3 2 0
16 14 8 5 2 2 0
17 8 5 3 6 3 0