Post Reply 
Solving a simple addition / multiplication puzzle.
02-18-2024, 09:07 AM (This post was last modified: 02-18-2024 10:11 AM by Thomas Klemm.)
Post: #5
RE: Solving a simple addition / multiplication puzzle.
This Python program is based on 2.1.5 Our Third Additive Solution of The 7-11 Problem:
Code:
N = 7_11_00_00_00
divs = [n for n in range(1, 711) if N % n == 0]

for a in divs:
    for b in [b for b in divs if a < b and a + b <= 709]:
        for c in [c for c in divs if b < c and a + b + c <= 710]:
            d = 711 - (a + b + c)
            if c < d and a * b * c * d == N:
                print(a, b, c, d)

Result

120 125 150 316

Using a single list-comprehensions makes it maybe easier to read:
Code:
[
    (a, b, c, d)
    for a in divs
    for b in divs
    for c in divs
    for d in [711 - (a + b + c)]
    if a < b < c < d and a + b + c < 711 and a * b * c * d == N
]

Result

[(120, 125, 150, 316)]

In this paper you can also find 2.2 Mathematical Approach:
Quote:We could also attempt to solve this without a computer program, and
exclude choices through mathematical trickery.

You can search for a+b+c+d=7.11=a*b*c*d and find plenty solutions.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Solving a simple addition / multiplication puzzle. - Thomas Klemm - 02-18-2024 09:07 AM



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