Skip to main content
deleted 29 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
lsts = Join[Thread[{Join[Range[5], Range[8, 10]]Range[8], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length @ 
  Select[
    Count[Last /@ #, "sing"] == 2 && 
    Count[Last /@ #, "dance"] == 2 && 
    CountDistinct[First /@ #] == 4 &] @
  Subsets[lsts, {4}]
199
lsts = Join[Thread[{Join[Range[5], Range[8, 10]], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length @ 
  Select[
    Count[Last /@ #, "sing"] == 2 && 
    Count[Last /@ #, "dance"] == 2 && 
    CountDistinct[First /@ #] == 4 &] @
  Subsets[lsts, {4}]
199
lsts = Join[Thread[{Range[8], "sing"}], Thread[{Range[6, 10], "dance"}]];

Length @ 
  Select[
    Count[Last /@ #, "sing"] == 2 && 
    Count[Last /@ #, "dance"] == 2 && 
    CountDistinct[First /@ #] == 4 &] @
  Subsets[lsts, {4}]
199
added 21 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
lsts = Join[Thread[{Join[Range[5], Range[8, 10]], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length[Length @ 
 Select[Count[Last Select[
    Count[Last /@ #, "sing"] == 2 && 
    Count[Last /@ #, "dance"] == 2 &]&& @
  Select[DuplicateFreeQ @* Map[First]]CountDistinct[First /@ #] == 4 &] @
  Subsets[lsts, {4}]]]
199
lsts = Join[Thread[{Join[Range[5], Range[8, 10]], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length[
 Select[Count[Last /@ #, "sing"] == 2 && Count[Last /@ #, "dance"] == 2 &] @
  Select[DuplicateFreeQ @* Map[First]] @ 
  Subsets[lsts, {4}]]
199
lsts = Join[Thread[{Join[Range[5], Range[8, 10]], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length @ 
  Select[
    Count[Last /@ #, "sing"] == 2 && 
    Count[Last /@ #, "dance"] == 2 && 
    CountDistinct[First /@ #] == 4 &] @
  Subsets[lsts, {4}]
199
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

lsts = Join[Thread[{Join[Range[5], Range[8, 10]], "sing"}], 
   Thread[{Range[6, 10], "dance"}]];

Length[
 Select[Count[Last /@ #, "sing"] == 2 && Count[Last /@ #, "dance"] == 2 &] @
  Select[DuplicateFreeQ @* Map[First]] @ 
  Subsets[lsts, {4}]]
199