Skip to content

Instantly share code, notes, and snippets.

@ricleal
Last active September 12, 2015 15:38
Show Gist options
  • Save ricleal/6b02e9c38f655e5b1f37 to your computer and use it in GitHub Desktop.
Save ricleal/6b02e9c38f655e5b1f37 to your computer and use it in GitHub Desktop.
vietnam_prob
import numpy as np
res = 66
def eq(x):
return x[0] + 13 * x[1] / x[2] + x[3] + 12 * x[4] - x[5] - 11 + x[6] * x[7] / x[8] - 10
# Brute force!
it = 0
while True:
x = np.random.random_integers(low=1,high=9,size=9)
if res == eq(x):
print it, '\tx =' , x
break
it+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment