這題建表是個好方法
n <= 10000
我先建一個 1~100 的質數表
然後開始建 n! 的表
n = 2, d[n] = {2: 1} n = 3, d[n] = {2: 1, 3: 1}n = 4, d[n] = {2: 3, 3: 1}n = 5, d[n] = {2: 3, 3: 1, 5:1}...n = 10000, d[n] = {.....}
每一個 d[n] 都是 d[n-1] + {n 的因數分解表}