Montgomery reduction for all Lucas tests