Skip to content

Instantly share code, notes, and snippets.

@jef-sure
Created October 28, 2024 21:36
Show Gist options
  • Save jef-sure/82fcbe2e3f88191ffa2654266b9ed0ad to your computer and use it in GitHub Desktop.
Save jef-sure/82fcbe2e3f88191ffa2654266b9ed0ad to your computer and use it in GitHub Desktop.
from itertools import permutations
perm = permutations([*range(0,10)], 7)
f, u, s, b, a, l, c = [1,2,3,4,5,6,7]
def fp():
return f + b == c or (u + a > 9 and f + b + 1 == c) or (s+l > 9 and u + a + 1> 9 and f + b + 1 == c)
def up():
return ((s+l+1) % 10) == u and (u + a + 1) % 10 == l
def sp():
return s+l > 9 and (s+l) % 10 == b and (s+l+1) % 10 == u
def bp():
return (s+l) % 10 == b
found = 0
for i in list(perm):
f, u, s, b, a, l, c = i
if fp() and up() and sp() and bp():
found = found + 1
print("FOUND")
print(f"{f}{u}{s}{s}")
print(f"{b}{a}{l}{l}")
print("----")
print(f"{c}{l}{u}{b}")
print()
print(f"total found {found}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment