add gcd
option to generate p = 3 mod 4