This programme does not work: It is not easy to factorise the numerator and keep track of all the factors.
{{subst:subst}}quadratic reciprocity/mod|{{{1}}}|{{{2}}}|+1}}