//組合わせ c= 1:重複あり, 0:重複なし function combinations (a = [ ], b = a.length, c = 1) { return 2 > b ? a.map(a =>[a]) : a.flatMap ((d,e)=> combinations (a.slice (e+1-c), b-1, c).map (e=> [d,...e])); } //順列 c= 1:重複あり, 0:重複なし function permutations (a =[ ], b = a.length, c = 1) { return 2 > b ? a.map (a => [a]…