Modular Exponentiation 2 by 51b

: a begin pad dup 40 stdin read-line + while evaluate rot over mod 2>r 1
begin over 2 mod if 2r@ swap */mod drop then r> dup r@ */mod drop >r swap 2/ tuck 0= until
0 .r cr 2r> repeat ; a

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page