Skip to main content
added 52 characters in body
Source Link
xyz
  • 655
  • 4
  • 38
  • 117

Like this?

func[n_,m_,l_]:=
  Cases[
   Tuples[{2n, 1m, 0l}, 3],
   {x_, y_, z_} /; 
    x >= y >= z && FromDigits[{2n, 1m, 0l}, 2]n] >= FromDigits[{x, y, z}, 2]n]
  ]

func[2,1,0]
{{2, 1, 0}, {2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}

Like this?

Cases[
 Tuples[{2, 1, 0}, 3],
 {x_, y_, z_} /; 
  x >= y >= z && FromDigits[{2, 1, 0}, 2] >= FromDigits[{x, y, z}, 2]
]
{{2, 1, 0}, {2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}

Like this?

func[n_,m_,l_]:=
  Cases[
   Tuples[{n, m, l}, 3],
   {x_, y_, z_} /; 
    x >= y >= z && FromDigits[{n, m, l}, n] >= FromDigits[{x, y, z}, n]
  ]

func[2,1,0]
{{2, 1, 0}, {2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}
added 12 characters in body
Source Link
xyz
  • 655
  • 4
  • 38
  • 117

Like this?

Cases[
 Tuples[{2, 1, 0}, 3],
 {x_, y_, z_} /; 
  x >= y >= z && FromDigits[{2, 1, 0}, 2] >>= FromDigits[{x, y, z}, 2]
]
{{2, 1, 0}, {2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}

Like this?

Cases[
 Tuples[{2, 1, 0}, 3],
 {x_, y_, z_} /; 
  x >= y >= z && FromDigits[{2, 1, 0}, 2] > FromDigits[{x, y, z}, 2]
]
{{2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}

Like this?

Cases[
 Tuples[{2, 1, 0}, 3],
 {x_, y_, z_} /; 
  x >= y >= z && FromDigits[{2, 1, 0}, 2] >= FromDigits[{x, y, z}, 2]
]
{{2, 1, 0}, {2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}
Source Link
xyz
  • 655
  • 4
  • 38
  • 117

Like this?

Cases[
 Tuples[{2, 1, 0}, 3],
 {x_, y_, z_} /; 
  x >= y >= z && FromDigits[{2, 1, 0}, 2] > FromDigits[{x, y, z}, 2]
]
{{2, 0, 0}, {1, 1, 1}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}