Skip to content

Instantly share code, notes, and snippets.

@paulofreitas
Created November 7, 2013 06:39
Show Gist options
  • Save paulofreitas/7350080 to your computer and use it in GitHub Desktop.
Save paulofreitas/7350080 to your computer and use it in GitHub Desktop.
#!/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