perl -e "my $n=20; for(@ARGV){$x=$n-1+($_-($n-1)%$_);print qq($n\[$_] :$x\n)}" 2 3 4 5 6 7 8 9 10 # resp. $x=$n-1+($M-($n-1)%$M)