哦,反复测试了几个数之后,
感觉 Mathematica的这两个函数似乎并不是很神奇。
我把n设大了,有好多数计算的非常的慢:
比如,将1729表示成10个数的立方,倒是很快的- PowersRepresentations[1729, 10, 3]
复制代码 {{0, 0, 0, 0, 0, 0, 0, 0, 1, 12}, {0, 0, 0, 0, 0, 0, 0, 0, 9, 10}, {0,
0, 0, 0, 0, 0, 1, 6, 8, 10}, {0, 0, 0, 0, 0, 1, 3, 3, 7, 11}, {0,
0, 0, 0, 1, 3, 3, 6, 9, 9}, {0, 0, 0, 0, 1, 3, 4, 5, 8, 10}, {0, 0,
0, 0, 2, 2, 3, 7, 7, 10}, {0, 0, 0, 0, 3, 3, 4, 4, 6, 11}, {0, 0, 0,
0, 4, 5, 5, 7, 7, 9}, {0, 0, 0, 1, 2, 6, 6, 6, 7, 9}, {0, 0, 0, 1,
4, 4, 4, 8, 8, 8}, {0, 0, 0, 2, 4, 4, 5, 5, 7, 10}, {0, 0, 0, 3, 3,
3, 4, 7, 8, 9}, {0, 0, 0, 3, 3, 3, 6, 6, 6, 10}, {0, 0, 1, 1, 1, 3,
3, 5, 6, 11}, {0, 0, 1, 1, 3, 3, 6, 6, 8, 9}, {0, 0, 1, 2, 2, 4, 4,
7, 8, 9}, {0, 0, 1, 2, 2, 4, 6, 6, 6, 10}, {0, 0, 1, 3, 3, 3, 4, 5,
9, 9}, {0, 0, 1, 4, 5, 5, 6, 7, 7, 8}, {0, 0, 2, 2, 5, 6, 7, 7, 7,
7}, {0, 0, 2, 3, 3, 3, 4, 4, 8, 10}, {0, 0, 2, 3, 4, 6, 6, 7, 7,
8}, {0, 0, 2, 4, 4, 6, 6, 6, 6, 9}, {0, 0, 3, 3, 3, 4, 4, 4, 5,
11}, {0, 1, 1, 1, 1, 4, 5, 8, 8, 8}, {0, 1, 1, 1, 2, 2, 7, 7, 8,
8}, {0, 1, 1, 1, 2, 5, 5, 5, 7, 10}, {0, 1, 1, 2, 2, 3, 5, 6, 7,
10}, {0, 1, 1, 2, 2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