# M (MUMPS) - <s>72</s> 70 R n F i=0:1:n W !,i S r=$TR($RE(i),69,96) W:r=+r*r'=i*'$TR(i,0689) "." Most built-in commands and functions in M have abbreviated versions. I've used the full names below. `READ n` - Read a string from the keyboard and store it in `n`. `FOR i=0:1:n` - Loop from zero to `n`, incrementing `i` by 1 each time. (The remainder of the line constitutes the body of the loop.) `WRITE !,i` - Print a newline followed by the value of `i`. `SET r=$TRANSLATE($REVERSE(i),69,96))` - Reverse `i`, replace nines with sixes and sixes with nines, and store that in `r`. `WRITE:r=+r*r'=i*'$TRANSLATE(i,0689) "."` - `:` - Denotes a postconditional expression, so the `WRITE` command is only executed if `r=+r*r'=i*'$TRANSLATE(i,0689)` evaluates to a truthy value. - `r=+r` - Check that `r` doesn't have a leading zero. The unary `+` operator converts a string to a number, which strips leading zeroes if there are any. - `*` - Multiplication operator. M has no order of operations; all binary operators are evaluated in the order they appear from left to right. - `r'=i` - Check that `i` isn't the same as it's flipped version `r`. - `'$TRANSLATE(i,0689)` - Remove all zeros, sixes, eights, and nines from `i`, and check that there's nothing left. (`'` is the logical negation operator.) - `"."` - Finally the argument to the `WRITE` command (a literal string). **Edit:** Made it a little shorter by abusing the multiplication operator. Previous version: R n F i=0:1:n W !,i S r=$TR($RE(i),69,96) I '$TR(i,0689),i'=r,r=+r W "."