7.11
The problem that I read this week, and to spare you from the context behind it, is very easy to understand: in essence, you have 4 numbers that correspond to prices of products, where the price has a precision of two decimal points (i.e., the format is $NN.nn). Call these numbers p1, p2, p3 and p4. The products are sold in a 7/11 store, and the coincidence at the heart of this problem is that these four numbers when multiplied altogether or when added up, the result is always 7.11. Mathematically speaking: p1+p2+p3+p4 = 7.11 p1*p2*p3*p4 = 7.11 Question becomes: what are the prices p1, p2, p3 and p4? Now, we have 2 equations and 4 variables which becomes extremely hard to solve. The book that I read this question at actually describes a 4-pages convoluted mathematical process to solve the problem, without any computers or algorithms. It is based on a number of very clever mathematical observations, but… I’d rather let the computer do the brute-force for me. The code to s...