July 2018 little math problem
07-29-2018, 10:27 PM
Post: #25
 Albert Chan Senior Member Posts: 2,556 Joined: Jul 2018
RE: July 2018 little math problem
Slight changes to my posted Python code (post 23) dramatically reduce checks down to 17 cases

Only patch is to change the loop range:
s range = [13, 14]
c range = range(max(1, ceg-8-9), min(9, ceg//2))
g range = range(c+1, min(10, 10 - s + ceg))

s range is reduced by taking advantage of 10-Complement Symmetry

c range is reduce because of this: c + e + g = ceg
min(c) = ceg - max(e + g) = ceg - 8 - 9
max(c) = ceg - min(e) - min(g) = ceg - 1 - (max(c) + 1)
max(c) * 2 = ceg - 2
max(c) < floor(ceg / 2)

g range is reduced because d = s - c - e = (s - ceg) + g
Since g is increasing inside loop, d is also increasing, remove invalid d, we get:
max(d) = (s - ceg) + max(g) < 10
max(g) < 10 - s + ceg

With above ranges, these are the only cases checked:

#1: 1 8 4 7 2 => [3, 9] 1 8 4 7 2 [5, 6]
#2: 1 9 3 7 3
#3: 2 9 2 8 3
#4: 1 5 8 4 2 => [6, 7] 1 5 8 4 2 [3, 9]
#5: 1 6 7 4 3 => [5, 8] 1 6 7 4 3 [2, 9]
#6: 1 7 6 4 4
#7: 1 8 5 4 5
#8: 1 9 4 4 6
#9: 2 6 6 5 3
#10: 2 7 5 5 4
#11: 2 8 4 5 5
#12: 2 9 3 5 6 => [4, 8] 2 9 3 5 6 [1, 7]
#13: 3 7 4 6 4
#14: 3 8 3 6 5
#15: 3 9 2 6 6
#16: 4 8 2 7 5 => [1, 9] 4 8 2 7 5 [3, 6]
#17: 4 9 1 7 6 => [2, 8] 4 9 1 7 6 [3, 5]

16X Symmetries: head swap, tail swap, reversing digits, 10-complement

Solutions = 6 primary solutions * 16 = 96
 « Next Oldest | Next Newest »

 Messages In This Thread July 2018 little math problem - pier4r - 07-25-2018, 08:52 PM RE: July 2018 little math problem - Voldemar - 07-25-2018, 09:33 PM RE: July 2018 little math problem - Thomas Klemm - 07-25-2018, 10:27 PM RE: July 2018 little math problem - Albert Chan - 07-26-2018, 12:16 AM RE: July 2018 little math problem - John Keith - 07-26-2018, 12:57 AM RE: July 2018 little math problem - DavidM - 07-26-2018, 04:03 AM RE: July 2018 little math problem - John Keith - 07-26-2018, 01:03 PM RE: July 2018 little math problem - DavidM - 07-26-2018, 03:38 PM RE: July 2018 little math problem - Albert Chan - 07-26-2018, 02:39 AM RE: July 2018 little math problem - Thomas Klemm - 07-26-2018, 03:42 AM RE: July 2018 little math problem - Albert Chan - 07-26-2018, 06:16 PM RE: July 2018 little math problem - pier4r - 07-26-2018, 12:36 PM RE: July 2018 little math problem - Thomas Klemm - 07-26-2018, 03:43 PM RE: July 2018 little math problem - pier4r - 07-27-2018, 10:03 AM RE: July 2018 little math problem - DavidM - 07-28-2018, 04:22 PM RE: July 2018 little math problem - Albert Chan - 07-29-2018, 12:10 AM RE: July 2018 little math problem - Albert Chan - 07-26-2018, 10:45 PM RE: July 2018 little math problem - Valentin Albillo - 07-27-2018, 01:30 AM RE: July 2018 little math problem - Albert Chan - 07-27-2018, 03:06 AM RE: July 2018 little math problem - cyrille de brĂ©bisson - 07-27-2018, 08:20 AM RE: July 2018 little math problem - Albert Chan - 07-27-2018, 03:37 PM RE: July 2018 little math problem - Albert Chan - 07-27-2018, 09:50 PM RE: July 2018 little math problem, mini-challenge - Albert Chan - 07-28-2018, 01:15 PM RE: July 2018 little math problem - Albert Chan - 07-29-2018, 01:02 PM RE: July 2018 little math problem - Albert Chan - 07-29-2018 10:27 PM RE: July 2018 little math problem - Komanguy - 07-31-2018, 08:19 PM RE: July 2018 little math problem - Albert Chan - 07-31-2018, 10:49 PM RE: July 2018 little math problem - Komanguy - 08-01-2018, 11:31 AM RE: July 2018 little math problem - pier4r - 08-01-2018, 02:13 PM RE: July 2018 little math problem - Albert Chan - 08-03-2018, 05:25 PM RE: July 2018 little math problem - Dave Britten - 08-13-2018, 01:54 AM

User(s) browsing this thread: 1 Guest(s)