一到九,六个数字组合,全部列出来?
2022-11-15
1到9,一共9个数字,选6个数字为一组,一共有 9!/6!/(9-6)! = 84 个组合。
具体是:
123456,123457,123458,123459,123467,123468,123469,123478,
123479,123489,123567,123568,123569,123578,123579,123589,
123678,123679,123689,123789,124567,124568,124569,124578,
124579,124589,124678,124679,124689,124789,125678,125679,
125689,125789,126789,134567,134568,134569,134578,134579,
134589,134678,134679,134689,134789,135678,135679,135689,
135789,136789,145678,145679,145689,145789,146789,156789,
234567,234568,234569,234578,234579,234589,234678,234679,
234689,234789,235678,235679,235689,235789,236789,245678,
245679,245689,245789,246789,256789,345678,345679,345689,
345789,346789,356789,456789,
total = 84
方便起见,写了一段fortran代码输出这些组合
附:fortran代码