Linear congruence algorithm linear Diophantine equation original root algorithm solution C++ implementation of quadratic congruence equation