polys: add more tests for modulargcd
polys: remove unnecessary while loops in modulargcd