Modular linear equation solver
ax = b (mod n)
Relies on Euclid's extended algorithm:
http://snippets.dzone.com/posts/show/4192
def solveLinearModularEquation(a, b, n): d, xx, yy = euclidExtended(a, n) if (b % d == 0): x0 = (xx * (b / d)) % n for i in xrange(0, d): print (x0 + i * (n / d)) % n, else: print "No solution" print