rewrite number theory module