3
$\begingroup$

I recently got asked how to achieve a result of 100 only using the numbers {1,7,7,7,7} (the number 1 can be used only once and the number 7 can be used four times at maximum so not every number have to be used) and the operations +, -, *, / and also brackets. So I tried many different calculations and never got to 100. Of course I cant try all the possible combinations so I thought I could use Mathematica to see wether this is possible or not. One idea would be to generate a set with all numbers (rather integers) we could get from all possible combinations and the other idea would be to find an explicit expression to calculate the result from the given numbers.

Examples:

7*7+7*7+1 = 99

7*(7+1)+7 = 63

7*(7+1)+7*7 = 105

((7 + 7)/7)*(7 + 1) = 16

7*7*(7/7 + 1) = 98

$\endgroup$
9
  • 1
    $\begingroup$ Cool ideas, have you try to implement them? $\endgroup$ – yarchik Feb 14 at 12:43
  • $\begingroup$ Do we use each operator only once? $\endgroup$ – Conor Cosnett Feb 14 at 12:51
  • 2
    $\begingroup$ You can use each operator as often as you want. $\endgroup$ – Arjihad Feb 14 at 12:53
  • $\begingroup$ Two related questions. $\endgroup$ – J. M.'s torpor Feb 14 at 12:56
  • 1
    $\begingroup$ I wrote {1,7,7,7,7} instead of {1,7} to express that the number 1 can only be used once and the number 7 can be used four times. So 7*7+7*7+1+1 is not valid. $\endgroup$ – Arjihad Feb 14 at 13:17
6
$\begingroup$

Here are all $4$ solutions to the puzzle

enter image description here

Technique #1

heavily plagiarizing this excellent answer

Apparently Groupings is the tool for the job!

ans = Groupings[
                 Permutations[{7, 7, 7, 7, 1}]~Join~Permutations[{7, 7, 7, 1}]
               , {Plus, Subtract, Times, Divide} -> 2
               , HoldForm
       ];
Grid[
     Thread[{Quiet[Select[ans, ReleaseHold[#] == 100 &]]} ] 
     , Frame -> All
     , FrameStyle -> Red
 ]
$\endgroup$

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