Skip to content

Instantly share code, notes, and snippets.

@TheBB
Last active August 29, 2015 14:07
Show Gist options
  • Save TheBB/ce7374b94fe1f3f4801f to your computer and use it in GitHub Desktop.
Save TheBB/ce7374b94fe1f3f4801f to your computer and use it in GitHub Desktop.
total = 1904
wc = 3
xc = 25
yc = 38
zc = 175
# roots = []
for w in xrange(0, total/wc + 1):
for x in xrange(0, (total - wc*w)/xc + 1):
for y in xrange(0, (total - wc*w - xc*x)/yc + 1):
for z in xrange(0, (total - wc*w - xc*x - yc*y)/zc + 1):
if w*wc + x*xc + y*yc + z*zc == total:
# roots.append((w,x,y,z))
print 'w={w: <3} x={x: <3} y={y: <3} z={z: <3}'.format(w=w, x=x, y=y, z=z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment