Home

# Leonard makes the google puzzles too difficult

combinatorics and permutations

What? I solved this problem a week or two ago when I read about it in a thread on SomethingAwful’s forums. Click the link to see my solution (Python script).

[[file missing]]

Took about 5 minutes. No books, no looking anything up. Just plain old simple problem solving and a little python. My brute force method takes a little under 2 minutes to solve on a wimpy 900Mhz G3 in python (slow).

My original solution didn’t take into account that you couldn’t press the same button twice. Once fixed I got the same answer Leonard did.

Read more to see Leonard’s description of the problem if you’re interested.

``````“Press five different (but not necessarily distinct) buttons to be put into this formula: AxB+C-D+E, which will be calculated to get the snack you want. Identify the snack you can’t get.”

Buttons: Array
(  =\> 16  =\> 23  =\> 61  =\> 7  =\> 7  =\> 7  =\> 13  =\> 13  =\> 13  =\> 19  =\> 19  =\> 21  =\> 27  =\> 56  =\> 56  =\> 73  =\> 77  =\> 97  =\> 11  =\> 37  =\> 41
)

Items: Array
(  =\> 917  =\> 134  =\> 1569  =\> 1649  =\> 1431  =\> 1622  =\> 233  =\> 2094  =\> 1072  =\> 915  =\> 1922  =\> 2437  =\> 2714  =\> 2491  =\> 1886  =\> 2812  =\> 426  =\> 1673  =\> 94  =\> 2139  =\> 2569  =\> 496  =\> 2249  =\> 1553  =\> 1580
)
``````