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  
( [0] =\> 16 [1] =\> 23 [2] =\> 61 [3] =\> 7 [4] =\> 7 [5] =\> 7 [6] =\> 13 [7] =\> 13 [8] =\> 13 [9] =\> 19 [10] =\> 19 [11] =\> 21 [12] =\> 27 [13] =\> 56 [14] =\> 56 [15] =\> 73 [16] =\> 77 [17] =\> 97 [18] =\> 11 [19] =\> 37 [20] =\> 41  
)



Items: Array  
( [0] =\> 917 [1] =\> 134 [2] =\> 1569 [3] =\> 1649 [4] =\> 1431 [5] =\> 1622 [6] =\> 233 [7] =\> 2094 [8] =\> 1072 [9] =\> 915 [10] =\> 1922 [11] =\> 2437 [12] =\> 2714 [13] =\> 2491 [14] =\> 1886 [15] =\> 2812 [16] =\> 426 [17] =\> 1673 [18] =\> 94 [19] =\> 2139 [20] =\> 2569 [21] =\> 496 [22] =\> 2249 [23] =\> 1553 [24] =\> 1580  
)