Last active
September 12, 2015 15:38
-
-
Save ricleal/6b02e9c38f655e5b1f37 to your computer and use it in GitHub Desktop.
vietnam_prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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