Created
November 7, 2013 06:39
-
-
Save paulofreitas/7350080 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
def matrix(n, i): | |
assert i < n | |
for j in range(n): | |
yield j + 1 + (i * n) | |
n = 10000 | |
search_n = 50000 | |
for m in range(n): | |
if search_n in matrix(n, m): | |
print 'index:', m | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment