New answers tagged

3

n Binomial[n - 1, k - 1] == k Binomial[n, k] // FullSimplify True


4

Update My original answer was fun but not efficient. sfunc[r_, d_, k_] := Module[{rng, s, df, se, g, fp, su, c, ans}, rng = Range[r]; s = Rest@Subsets[rng]; df[x_?(Length@# == 1 &)] := Infinity; df[x_] := Min[Differences@x]; se = Select[s, df[#] >= d &]; g = RelationGraph[Intersection[#1, #2] == {} &, se]; c = FindClique[g, {k}, ...


3

A brute force approach (not to be used with large lists): partitionsF[lst_, k_, cond_] := Module[{s1 = Subsets[lst, {1, Infinity}], s2, sF1 = (And @@ (! cond @@ # & /@ Subsets[#, {2}])) &, sF2 = And[ Union @@ # == lst, ## & @@ (Intersection@@# == {} & /@ Subsets[#, {2}])] &}, s2 = Subsets[Pick[s1, sF1 /@ s1], {k}]; Pick[s2, ...


3

This should do ConditionalPartition[list_, k_, cond_] := Module[{y}, y = Table[{}, {k}]; Do[Do[ If[y[[j]] == {} || (AllTrue[y[[j]], cond[#, list[[i]]] &] && Quiet[y[[j + 1]] =!= {}]), AppendTo[y[[j]], list[[i]]]; Break[]] , {j, k}], {i, Length@list}]; If[Sort[list] == Sort@Flatten[y, 1], y, $Failed] ] list is the set, ...



Top 50 recent answers are included