5
$\begingroup$
Select[Tuples[{1, 1/2}, {4, 4}], Total [#] == 15]

I want to select all tuples in the result returned by Tuples that have total of their elements equal to 15. The answer I got was only {}. Why?

$\endgroup$
4
$\begingroup$

There was an excelent answer with an illustration, but I would like to point out the specific mistakes:

  • Pure function in the second argmuent should end with &
  • Total[#] by default only sums on the first level, but you need more.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.