mathematica中的命令integerPartitions为何有重复的元素?

2025-03-13 07:43:22
推荐回答(2个)
回答1:

代码如下:
Select[IntegerPartitions[69,3,{21,22,23,24,25}], DuplicateFreeQ]

回答2:

m = {1, 2, 3, 4, 5};
n = {1, 2, 3, 4, 5};
Union[ Flatten[
Table[ m[[i]] - n[[j]], {i, Length[m]}, {j, Length[n]}]]]
结果为
{-4, -3, -2, -1, 0, 1, 2, 3, 4}
不知道你要的是不是这个?