replace if(mod(x,a) == 0) sentences with mod(x-1,a)