Skip to content

Instantly share code, notes, and snippets.

@cdwfs
Created February 11, 2020 04:10
Show Gist options
  • Save cdwfs/60e121021df04da75be1318ac061bddf to your computer and use it in GitHub Desktop.
Save cdwfs/60e121021df04da75be1318ac061bddf to your computer and use it in GitHub Desktop.
if __name__ == "__main__":
for a in range(1,10):
for b in range(1,10):
if b in [a]:
continue
for c in range(1,10):
if c in [a,b]:
continue
for d in range(1,10):
if d in [a,b,c]:
continue
for e in range(1,10):
if e in [a,b,c,d]:
continue
x = (a + (b*0.1)) * (c + (d*0.1) + (e*0.01))
if (x.is_integer()):
print("%d.%d * %d.%d%d = %f" % (a,b,c,d,e,x))
# Output:
# 1.6 * 3.75 = 6.000000
# 1.6 * 8.75 = 14.000000
# 2.4 * 3.75 = 9.000000
# 2.4 * 8.75 = 21.000000
# 3.2 * 8.75 = 28.000000
# 4.8 * 1.25 = 6.000000
# 4.8 * 3.75 = 18.000000
# 4.8 * 6.25 = 30.000000
# 6.4 * 1.25 = 8.000000
# 6.4 * 3.75 = 24.000000
# 6.4 * 8.75 = 56.000000
# 9.6 * 1.25 = 12.000000
# 9.6 * 3.75 = 36.000000
# 9.6 * 8.75 = 84.000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment