July 2018 little math problem
|
07-29-2018, 12:10 AM
(This post was last modified: 07-29-2018 08:12 PM by Albert Chan.)
Post: #23
|
|||
|
|||
RE: July 2018 little math problem
(07-28-2018 04:22 PM)DavidM Wrote: I'm still trying to wrap my ahead around Albert's and Valentin's approach, Hi, DavidM: With comments, I can finally understand the code. Thanks. I do not own any HP calculators (except a hand-me-down HP-12C) I tried coding in Python, and possibilities is not as high as 252 Brute force all possible values of sum, and it only need 144 Even if sum of 15 is added (why?), it will only reach 180 With complement symmetry, it could be reduced to 72 4 s = 45 + c + e + g = (45 + 1 + 2 + 3) to (45 + 7 + 8 + 9) = 51 to 69 = 52, 56, 60, 64, 68 --> s = 13, 14, 15, 16, 17 when s = c + d + e =15, c + e + g = 4 s - 45 = 15, which imply d=g, thus s != 15 Code: for s in [13, 14, 16, 17]: And, the expected result ... [3, 9] 1 8 4 7 2 [5, 6] [6, 7] 1 5 8 4 2 [3, 9] [5, 8] 1 6 7 4 3 [2, 9] [4, 8] 2 9 3 5 6 [1, 7] [1, 9] 4 8 2 7 5 [3, 6] [2, 8] 4 9 1 7 6 [3, 5] [5, 7] 4 3 9 1 6 [2, 8] [3, 9] 4 5 7 1 8 [2, 6] [4, 7] 5 3 8 2 6 [1, 9] [1, 8] 7 6 3 4 9 [2, 5] [1, 7] 8 6 2 5 9 [3, 4] [4, 5] 8 3 6 2 9 [1, 7] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)