Skip to content

Instantly share code, notes, and snippets.

@jmccardle
Created July 5, 2023 17:48
Show Gist options
  • Save jmccardle/d6dd9c1576542269f0612574941de771 to your computer and use it in GitHub Desktop.
Save jmccardle/d6dd9c1576542269f0612574941de771 to your computer and use it in GitHub Desktop.
# See diagram: https://i.imgur.com/UWDrqcH.png
from itertools import permutations
for i, perm in enumerate(permutations([1,2,3,4,5,6,7])):
a, b, c, d, e, f, g = perm
if (a + d + g + f) / 2 == (b + d + e + g) / 3 == (c + e + f + g) / 4:
print(f"\n{i}. Solution: a = {a}, b = {b}, c = {c}, d = {d}, e = {e}, f = {f}, x = {(a+d+g+f)/2}")
else:
print(f"{i} ", end='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment