# Solving calculation puzzle [closed]

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

• Cool ideas, have you try to implement them? – yarchik Feb 14 at 12:43
• Do we use each operator only once? – Conor Cosnett Feb 14 at 12:51
• You can use each operator as often as you want. – Arjihad Feb 14 at 12:53
• Two related questions. – J. M.'s torpor Feb 14 at 12:56
• 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. – Arjihad Feb 14 at 13:17

Here are all $$4$$ solutions to the puzzle # Technique #1

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
]
{"ft_lang_label":"__label__en","ft_lang_prob":0.875242,"math_prob":0.9744992,"size":959,"snap":"2021-31-2021-39","text_gpt3_token_len":298,"char_repetition_ratio":0.13403141,"word_repetition_ratio":0.055248618,"special_character_ratio":0.34619394,"punctuation_ratio":0.089686096,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99538344,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-07-31T23:12:24Z\",\"WARC-Record-ID\":\"<urn:uuid:2bbe9f6c-9870-46ab-aeb7-d98c1b4a7683>\",\"Content-Length\":\"154463\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:1a482332-23ed-472c-b8de-22c824ad62cd>\",\"WARC-Concurrent-To\":\"<urn:uuid:a78de641-ae20-4460-8f19-116bd5eb3cd8>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://mathematica.stackexchange.com/questions/240013/solving-calculation-puzzle/240024\",\"WARC-Payload-Digest\":\"sha1:54KUAN4P3VXLHM4I25LHK5IEHPJMNHYJ\",\"WARC-Block-Digest\":\"sha1:YBCR244M7SHDWDWBS6SLNDAPYO36PQS6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-31/CC-MAIN-2021-31_segments_1627046154126.73_warc_CC-MAIN-20210731203400-20210731233400-00466.warc.gz\"}"}